**author** = 'ZhongH'

class Solution:

# @param {integer} n

# @return {string}

def **init**(self):

self.str = []

```
def countAndSay(self, n):
self.str.append("1")
self.str.append("11")
i = 2
while i < n:
j = 0
index = 0
res = 0
tmp = ""
l = len(self.str[i-1])
while j < l:
if self.str[i-1][j] == self.str[i-1][index]:
res += 1
else:
tmp+=str(res)
tmp+=self.str[i-1][index]
res=1
index = j
j+=1
tmp+=str(res)
tmp+=self.str[i-1][index]
i+=1
self.str.append(tmp)
return self.str[n-1]
```