The sum of digits of a two-digit number#933

The sum of digits of a two-digit number (Editorial)

Written By : MathModel

Since the string may contain some other invalid symbols , we reject them and only count digits

we read character by charcter and convert it to int (if possible)

s=input()
ans=0
d=list('0123456789')
for i in s:
    if(i in d):ans+=int(i)
print(ans)