def ratio(s): return (s.count("G")+s.count("C"))/len(s) while True: try: n=0 s=input().strip() l=int(input()) str_list=[] for i in range(len(s)-l+1): if ratio(s[i:i+l])>n: str_list.append(s[i:i+l]) n=ratio(s[i:i+l]) print(str_list[-1]) except: break
def ratio(s): return (s.count("G")+s.count("C"))/len(s) while True: try: n=0 s=input().strip() l=int(input()) str_list=[] for i in range(len(s)-l+1): if ratio(s[i:i+l])>n: str_list.append(s[i:i+l]) n=ratio(s[i:i+l]) print(str_list[-1]) except: break