方案:

str = input()
target_len = int(input())
g = 0
rat = 0
for i in range(0, len(str) - target_len + 1):
GC = str.count('G', i, i + target_len) + str.count('C', i, i + target_len)
if GC > g:
g = GC
rat = i
print(str[rat:rat + target_len])