#define PROBLEM "https://yukicoder.me/problems/no/1469" #include using namespace std; using ll = long long; template using V = std::vector; #define REP(i, n) for (ll i = (ll)0; i < (ll)(n); i++) #define REPS(i, s, n) for (ll i = (ll)(s); i < (ll)(n); i++) #define RREP(i, n) for (ll i = (ll)(n); i > (ll)0; i--) #define RREPS(i, s, n) for (ll i = (ll)(n); i > (ll)(s); i--) struct io { io() { cin.tie(0)->sync_with_stdio(0); } } caller; template struct RunLengthEncoding { public: RunLengthEncoding() = default; std::vector> encode(const std::vector &v) { std::vector> ret; for (int i = 0; i < v.size();) { int j = i; while (j < v.size() && v[j] == v[i]) j++; ret.emplace_back(v[i], j - i); i = j; } return ret; } std::vector> encode(const std::string &s) { return encode(std::vector(begin(s), end(s))); } std::vector decode(const std::vector> &code) { std::vector ret; for (const auto &[c, cnt]: code) { for (int i = 0; i < cnt; i++) ret.push_back(c); } return ret; } std::string decode_s(const std::vector> &code) { std::vector v = decode(code); return std::string(begin(v), end(v)); } }; int main() { string s; cin >> s; RunLengthEncoding rle; auto code = rle.encode(s); for (const auto &[c, cnt]: code) cout << c; cout << endl; return 0; }