Advertisement
Josif_tepe

Untitled

Apr 12th, 2021
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 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[i] == s[j] and j < s.size()) {
  11.             j++;
  12.             cnt++;
  13.         }
  14.         cout << cnt << s[i];
  15.         i = j - 1;
  16.     }
  17.     return 0;
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement