fork download
  1.  
  2. #include <iostream>
  3. #include <string>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. //ifstream cin("input.txt");
  9. //ofstream cout("output.txt");
  10. int n,i,j,m,sr;
  11. string words;
  12. getline(cin,words);
  13. m=0;
  14. n=words.length();
  15. for (i=0;i<n;i++)
  16. {
  17. sr=(int)(words[i]);
  18. if (sr>=97&&sr<=122)
  19. m++;
  20. for (j=0;j<m;j++)
  21. words.erase(j,1);
  22. }
  23. cout<<words;
  24. return 0;
  25. }
Runtime error #stdin #stdout #stderr 0s 4384KB
stdin
12abc567defg
stdout
Standard output is empty
stderr
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::erase: __pos (which is 2) > this->size() (which is 1)