problem FLOW004 on codechef

I believe I have a correct solution for problem FLOW004 on codechef. But I keep getting “wrong answer” when I try to submit. Please help.

Here is the link for the problem: FLOW004 Problem - CodeChef

My code(Python 3.6):
t=int(input())

for x in range(t):
a = int(input())
an=a%10
while(a>0):
a=a//10
if(a//10==0):
an+=a
print(an)

1 Like

what is the expected output for single digit numbers ?

1 Like

Thanks man!!!

1 Like

read the input as string:
(s[0] - ‘0’) * 2, so this problem answer is (s[0] - ‘0’) + (s[n-1] - ‘0’) which covers single digit