Advertisement
Josif_tepe

Untitled

Mar 29th, 2021
98
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 n;
  6.     cin >> n;
  7.     for(int i = 0; i < n.size(); i++) {
  8.         char c = n[i];
  9.         int brojac = 0;
  10.         while(i < n.size() and c == n[i]) {
  11.             i++;
  12.             brojac++;
  13.         }
  14.         i -= 1;
  15.         cout << brojac << c;
  16.     }
  17.     return 0;
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement