fork download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main(){
  6. string nome;
  7. long long soma = 0;
  8. cin >> nome;
  9. for (char c : nome) soma += c - 48;
  10. cout << soma;
  11. }
Success #stdin #stdout 0s 15232KB
stdin
123456789
stdout
45