string countAndSay(int n) {
string s = "1";
for(int i=0;i<n-1;i++)
{
string temp;
for(int j = 0;j<s.size();j++)
{
int cnt = 1;
while(j+1<s.size() && s[j] == s[j+1])
{
cnt++;
j++;
}
temp += to_string(cnt)+s[j];
}
s = temp;
}
return s;
}