Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- int main()
- {
- using namespace std;
- string input; int s=0, index=NULL;
- cin >> input;
- for (int i = 0; i < input.size(); i++) {
- if (input[i] == input[i + 1]) {
- s++;
- if (index == NULL) {
- index = i + 1;
- }
- }
- }
- input.erase(index, s);
- input.insert(index, 1, char(s+49));
- cout << input;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement