class Zipper { public: string zipString(string iniString) { char p = 0; int cnt = 0; string ret; int i = 0, n = iniString.size(); while (i < n) { int j = i; while (j < n && iniString[j] == iniString[i]) ++j; ret += iniString[i]; ret += to_string(j-i); i = j; } if (ret.size() < iniString.size()) return ret; return iniString; } };