class Solution {
public:
string revolution(string s)
{
string ret="";
int count=1;
char pre=s[0];
for(int i=0;i<s.size();i++)
{
if(s[i+1]==pre)
count++;
else
{
char tmp=count+'0';
ret=ret+tmp+pre;
pre=s[i+1];
count=1;
}
}
return ret;
}
string countAndSay(int n) {
string ret="1";
int j=1;
while(j<n){
ret=revolution(ret);
j++;
}
return ret;
}
};
public:
string revolution(string s)
{
string ret="";
int count=1;
char pre=s[0];
for(int i=0;i<s.size();i++)
{
if(s[i+1]==pre)
count++;
else
{
char tmp=count+'0';
ret=ret+tmp+pre;
pre=s[i+1];
count=1;
}
}
return ret;
}
string countAndSay(int n) {
string ret="1";
int j=1;
while(j<n){
ret=revolution(ret);
j++;
}
return ret;
}
};