class Solution(object):

def countAndSay(self, n):

"""

:type n: int

:rtype: str

"""

```
res="1"
res1=""
iter = 0
while iter < n-1:
index = 0
count = 1
while index + 1 < len(res):
if res[index+1] == res[index]:
count = count + 1
index = index + 1
else:
res1 = res1 + "%d%s" % (count, res[index])
count = 1
index = index + 1
else:
res1 = res1 + "%d%s" % (count, res[index])
iter = iter + 1
res = res1
print res
res1 = ""
return res
```