S002-AC.cc
322 Bytes
#include <iostream>
#include <string>
using namespace std;
int main()
{
string str;
int sum;
while(1)
{
cin >> str;
if(cin.eof())
{
return 0;
}
sum = 0;
for(int i = 0; i < str.size(); i++)
{
sum += str[i]-48;
}
cout << "The sum of the digits of " << str << " is " << sum << "." << endl;
}
}