fork download
  1. #include <iostream>
  2. #include <cctype>
  3.  
  4. std::string isolate_word(const std::string &word) {
  5. std::string isolated_word;
  6. for(auto iter = word.cbegin(); iter != word.cend(); ++iter) {
  7. if(!std::ispunct(*iter)) {
  8. isolated_word+=std::tolower(*iter);
  9. }
  10. }
  11. return isolated_word;
  12. }
  13.  
  14. int main(void) {
  15. std::cout << isolate_word("(,he,llo,)") << '\n';
  16. return 0;
  17. }
Success #stdin #stdout 0s 3028KB
stdin
Standard input is empty
stdout
hello