fork(1) download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. string a = "abbaca";
  8. int i = 0;
  9. while (i < a.size()){
  10. if (a[i] == a[i+1]){
  11. a.erase(i, 2);
  12. i = 0;
  13. }
  14. else{
  15. i++;
  16. }
  17. }
  18. cout << a;
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0s 5300KB
stdin
Standard input is empty
stdout
ca