Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- string s(99, '1');
- cin >> s;
- while (s.find("111") != string::npos) {
- s.replace(s.find("111"), 3, "22");
- if (s.find("222") != string::npos) {
- s.replace(s.find("222"), 3, "11");
- }
- }
- cout << s;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement