[Community Puzzle] Kaprekar's Routine


#1

I am little bit confused about the possible output of this puzzle.
My code is passing all the test cases but failing for Validator2 when submitting the code.
I have tried different logics but still failing. Problem description doesn’t give much rules as well.
Totally stuck and no clue.