n = int(input()) a = n // 1000b = (n // 100) % 10c = (n // 10) % 10d = n % 10 print(a + b + c + d)
1234
10
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!