Is their a printing mistake?

Can you please tell whether their is a printing mistake , as my output is coming correct.

@1999atrijsharma
the input string can have size<=10
so for input like say 3816 you dont get the correct answer