1 class Zipper { 2 public: 3 string zipString(string iniString) { 4 // write code here 5 string out; 6 char ch=iniString[0]; 7 int n = 0; 8 for(int i=0;i<=iniString.size();++i) 9 { 10 if(iniString[i]!=ch) 11 { 12 out=out+ch+to_string(n); 13 n=1; 14 ch = iniString[i]; 15 } 16 else 17 { 18 n++; 19 } 20 21 } 22 if(out.size()>=iniString.size()) 23 return iniString; 24 return out; 25 } 26 };