fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <locale>
  4. #include <algorithm>
  5.  
  6. using namespace std;
  7.  
  8. int main() {
  9. string s1 = "How. aRe. yOu?";
  10. string s2 = "how are you";
  11.  
  12. cout << "before:" << s1 << endl;
  13. s1.erase(remove_if(s1.begin(), s1.end(), static_cast<int(*)(int)>(ispunct)), s1.end());
  14. transform(s1.begin(), s1.end(), s1.begin(), static_cast<int(*)(int)>(tolower));
  15. cout << "after:" << s1 << endl;
  16.  
  17. cout << boolalpha << (s1 == s2) << endl;
  18. return 0;
  19. }
Success #stdin #stdout 0s 16056KB
stdin
Standard input is empty
stdout
before:How. aRe. yOu?
after:how are you
true