Advertisement
Josif_tepe

Untitled

Apr 13th, 2021
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     string s;
  6.     cin >> s;
  7.     for(int i = 0; i < s.size(); i++) {
  8.         int j = i;
  9.         int cnt = 0;
  10.         while(s[j] == s[i]) {
  11.             j++;
  12.             cnt++;
  13.         }
  14.         cout << cnt << s[i];
  15.         i = j - 1;
  16.     }
  17.     return 0;
  18. }
  19.  
  20.  
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement