# Arup Guha
# 3/9/2021
# Solution to 2021 UCF HS Contest Problem: Worse Code

# Get the number of cases.
n = int(input(""))

# Process the cases.
for i in range(n):

    # All we care about is the length of each token on a line!
    toks = input("").split()
    for j in range(len(toks)):
        print(chr(len(toks[j])+ord('A')-1), end="")
    print()
            
