#include using namespace std; int main() { for (int n; cin >> n; ) { int s = 0; while (n) { s += n % 10; n /= 10; } cout << s << endl; } return 0; }