fork download
  1. #include <string>
  2. #include <iostream>
  3.  
  4. int main()
  5. {
  6. std::string input, output;
  7.  
  8. std::cin >> input;
  9.  
  10. if (input.size() > 0) {
  11. output += input[0];
  12. }
  13. for (auto it = input.begin() + 1; it != input.end(); ++it) {
  14. if (*it != *(it-1)) {
  15. output += *it;
  16. }
  17. }
  18.  
  19. std::cout << output << std::endl;
  20.  
  21. return 0;
  22. }
Success #stdin #stdout 0s 3476KB
stdin
43w5s4ed6r5f7tyutuyfuytfytf8tft8tf8t88f8ft88ft68ft68ft
stdout
43w5s4ed6r5f7tyutuyfuytfytf8tft8tf8t8f8ft8ft68ft68ft