Advertisement
donarturo1991

disapearingPairs

Jul 28th, 2021
388
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.21 KB | None | 0 0
  1. string solution(string &S) {
  2.     // write your code in C++14 (g++ 6.2.0)
  3.  
  4. for (short i=0; i<S.length(); i++) {
  5.     if (S[i]==S[i-1]) {
  6.         S.erase(i-1, 2);
  7.         i=0;
  8.         }
  9. }
  10.  
  11.  
  12. return S;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement