C++ Easy to understand


#1
`string Solution::countAndSay(int n) {
string s("1");
string res = "";
while(n > 1){
  int count = 0;char ch = s[0]; 
  for(int i=0;i<s.length();i++){
     if(s[i] == ch) count++;
     else{ res += to_string(count); res += ch; ch = s[i], count = 1; }
  }
  res += to_string(count); res += ch;
  s = res;
  res.clear();
  n--;
}
return s;    
}

`