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