Untitled

mail@pastecode.io avatar
unknown
c_cpp
3 years ago
458 B
1
Indexable
Never
#include <bits/stdc++.h>

using namespace std;
const int maxn = 2e5 + 10;
typedef long long ll;


int main()
{
    ios_base::sync_with_stdio(false);
    string s;
    cin >> s;
    for(int i = 0; i < (int) s.size(); i++) {
        int j = i;
        int cnt = 0;
        while(j < (int) s.size() and s[j] == s[i]) {
            cnt++;
            j++;
        }
        i = j - 1;
        cout << cnt << s[i];
    }
    return 0;
}