fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <algorithm>
  4. #include <assert.h>
  5. using namespace std;
  6. unsigned long long convertStrintToInt(string s)
  7. {
  8. int l=s.length()-1;
  9. unsigned long long num=0;
  10. int dig=1;
  11. while(l>=0)
  12. {
  13. int c=1;
  14. assert(s[l]>='0'&&s[l]<='9');
  15.  
  16. num+=(s[l]-48)*dig;
  17. dig*=10;
  18. l--;
  19. }
  20. // For TEST
  21. //long long cpy=stoi(s);
  22. //assert(num==cpy);
  23.  
  24. return num;
  25. }
  26. string add9999(string s)
  27. {
  28. unsigned long long num=convertStrintToInt(s);
  29. return to_string((num+9999));
  30. }
  31. int main() {
  32. string s;
  33. cin>>s;
  34. cout<<add9999(s);
  35. return 0;
  36. }
Success #stdin #stdout 0.01s 5280KB
stdin
124342232424
stdout
18446744073497742455