fork download
  1. #include <iostream>
  2. using namespace std;
  3. #define ll long long
  4.  
  5. ll tcs (string x)
  6. {
  7. ll t = 0;
  8.  
  9. for (char i : x)
  10. {
  11. t += (i - '0');
  12. }
  13.  
  14. return t;
  15. }
  16.  
  17. int main() {
  18. string s; cin >> s;
  19.  
  20. cout << tcs(s);
  21. }
Success #stdin #stdout 0s 5348KB
stdin
985412365478562
stdout
75