#include using namespace std; #pragma once #include #include #include template std::vector> runlength_encoding(const std::vector& v) { std::vector> ret = {{v[0], 1}}; for(size_t i = 1; i < v.size(); i++) { if(ret.back().first == v[i]) ret.back().second++; else ret.emplace_back(v[i], 1); } return ret; } std::vector> runlength_encoding(const std::string& s) { std::vector> ret = {{s[0], 1}}; for(size_t i = 1; i < s.size(); i++) { if(ret.back().first == s[i]) ret.back().second++; else ret.emplace_back(s[i], 1); } return ret; } int main() { string s; cin >> s; auto v = runlength_encoding(s); for(const auto& [c, _] : v) cout << c; cout << endl; }