fork(3) download
  1. #include <string>
  2. #include <algorithm>
  3. #include <iostream>
  4. #include <cstring>
  5. #include <cctype>
  6.  
  7. using namespace std;
  8.  
  9. struct is_char_category_in_question {
  10. bool operator()(const char& c) const {
  11. return std::ispunct(c) || std::isspace(c);
  12. }
  13. };
  14.  
  15. int main() {
  16. static char str1[100] = "str,, ing";
  17. size_t size = strlen(str1);
  18.  
  19. remove_if(&str1[0], &str1[size + 1], is_char_category_in_question());
  20.  
  21. cout << str1 << endl;
  22. }
  23.  
  24.  
Success #stdin #stdout 0s 2684KB
stdin
Standard input is empty
stdout
string