package oj.test;
import java.util.Scanner;
public class Demo11 {
/**
* @DNA序列
*/
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str = sc.nextLine();
int length = sc.nextInt();
System.out.println(sub_string(str,length));
}
private static String sub_string(String str, int length) {
String mid_result = "";
String result="";
int max = 0;
for(int x = 0;x<str.length()-length+1;x++){
int count = 0 ;
String temp = str.substring(x, x+length);
mid_result = temp;
//System.out.println(mid_result);
for(int i =0;i<temp.length();i++){
while(temp.isEmpty()==false){
if(temp.startsWith('G'+""))
count++;
else if(temp.startsWith('C'+""))
count++;
temp=temp.substring(1);
}
if(count > max){
max=count;
result = mid_result;
}
}
//System.out.println(count);
}
return result;
}
}