The current result are always read and count the previous result, so...

```
string res, tmp;
if (n == 1) return "1";
while (n>0){
int count = 1;
res = countAndSay(--n);
tmp = "";
for (int i = 0; i<res.size(); i++){
if (res[i] == res[i + 1]) count++;
else{
tmp += to_string(count) + res[i];
count = 1;
}
}
return tmp;
}
}
```