class Solution:
    def recursive(self, n) :
        if n == 1 :
            return "1"
        arr = self.recursive(n-1)
        count, check = 0, 0
        temp = []
        for j in arr :
            if count == 0 :
                check,count = j,1
            elif check == j :
                count += 1
            else :
                temp.append(str(count)+str(check))
                count, check = 1, j
        temp.append(str(count)+str(j))
        return "".join(temp)
    def countAndSay(self, n: int) -> str:
        return self.recursive(n)