```
class Solution(object):
def countAndSay(self, n):
"""
:type n: int
:rtype: str
"""
s = '1'
for i in range(n - 1):
s = self.sayIt(s)
return s
def sayIt(self, s):
res = []
i = 0
while i < len(s):
count = 1
num = s[i]
while i + 1< len(s) and s[i] == s[i + 1]:
i += 1
count += 1
i += 1
res += [str(count), str(num)]
return ''.join(res)
```