Advertisement
Josif_tepe

Untitled

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