Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <string>
- #include <cmath>
- #include <set>
- using namespace std;
- int main() {
- string s;
- cin >> s;
- for(int i = 0; i < s.size(); i++) {
- int j = i;
- int cnt = 0;
- while(j < s.size() and s[i] == s[j]) {
- cnt++;
- j++;
- }
- cout << cnt << s[i];
- i = j - 1;
- }
- return 0;
- }
- // 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement