class Solution:
# @param {integer} n
# @return {string}
def countAndSay(self, n):
str = "1"
for i in range(n-1):
temp = str; str = ""; count = 1
for j in xrange(len(temp)-1):
if temp[j]==temp[j+1]:
count += 1
else:
str += ("%d"%count + temp[j])
count = 1
str += ("%d"%count + temp[len(temp)-1])
return str