Josif_tepe

Untitled

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