fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <sstream>
  4. using namespace std;
  5. int main() {
  6. string text = "1text3 and 9wjkhk2 keyboard 3txcym8";
  7. stringstream ss(text);
  8. string buffer;
  9. while (ss >> buffer)
  10. {
  11. if (isdigit(buffer.front()) && isdigit(buffer.back()))
  12. {
  13. text.erase(text.find(buffer), buffer.length());
  14. }
  15. }
  16.  
  17. cout << text << endl;
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0s 4464KB
stdin
Standard input is empty
stdout
 and  keyboard