[C++][Count And Say] simple solution


#1
string getNext(string s) {
    string res = "";
    int count = 1, i;
    for(i=1; i<s.length(); i++) {
        if(s[i] == s[i-1])  count ++;
        else {
            res += to_string(count)+s[i-1];
            count = 1;
        }
    }
    res += to_string(count)+s[i-1];  // for last sequence
    return res;
}
string Solution::countAndSay(int A) {
    string res = to_string(1);
    while(--A)  res  = getNext(res);
    return res;
}