For this Question: We are given a string. Your task is to compress the consecutive letters of the string 

For example, given string is "AAACCCBBD", thus here
A's occurrence 3 times
C's occurrence 3 times
B's occurrence 2 times
D's occurrence 1 time
So after compressing string becomes "A3C3B2D1".The first line of input contains an integer T denoting the number of test cases. Each test case will have a string provided in the new line.

Constraints: 
1 <= T <= 10
1 <= sizeof(String) <= 10^6
All characters of String are upper case letters. (A-Z)

Sum of size of Strings over all testcases is <= 10^6For each testcase, in a new line, print the compressed string for each test case in a new line. Input:
2
AAACCCBBD
ABCD 

Output:
A3C3B2D1
A1B1C1D1, I have written this Solution Code: 
def compress(st):
    n = len(st)
    i = 0
    while i < n:
        count = 1
        while (i < n-1  and st[i] == st[i + 1]):
            count += 1
            i += 1
        i += 1
        print(st[i-1] +str(count),end="")

t=int(input())
for i in range(t):
    s=input()
    compress(s)
    print(), In this Programming Language: Python, Now tell me if this Code is compilable or not?