#Solution provided by Sloth Coders n = int(input()) for _ in range(n): num = input() sum = 0 for i in num: sum += int(i) print(sum)