fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <algorithm>
  4. #include <iomanip>
  5.  
  6. int main() {
  7. //make lower
  8. std::string a = "HELLO";
  9. std::transform(a.begin(), a.end(), a.begin(), ::tolower);
  10. std::cout << a << std::endl;
  11.  
  12. //reverse string
  13. std::string b{a.rbegin(), a.rend()};
  14. std::cout << b << std::endl;
  15.  
  16. //contains
  17. bool c = (b.find('e') != std::string::npos);
  18. std::cout << std::boolalpha << c << std::endl;
  19.  
  20. //remove at index
  21. std::string s = "hello";
  22. s.erase(s.begin() +4); // or s.erase(4,1);
  23. std::cout<< s << std::endl;
  24. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
hello
olleh
true
hell