G2A Many GEOs
SHARE
TWEET

lab 4

a guest Apr 5th, 2020 114 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. #include <iostream>
  4. #include <string>
  5. int main()
  6. {  
  7.     using namespace std;
  8.     string input; int s=0, index=NULL;
  9.     cin >> input;
  10.     for (int i = 0; i < input.size(); i++) {
  11.         if (input[i] == input[i + 1]) {
  12.             s++;
  13.             if (index == NULL) {
  14.                 index = i + 1;
  15.             }
  16.         }
  17.     }
  18.     input.erase(index, s);
  19.     input.insert(index, 1, char(s+49));
  20.     cout << input;
  21.     return 0;
  22. }
RAW Paste Data
Ledger Nano X - The secure hardware wallet
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top