const getGCRatio = str => {
  return str.match(/[GC]/g).length / str.length
}
while(str = readline()) {
  const len = ~~readline();
  let i=0;
  let res = {
    v: "",
    gcRatio: 0
  };
  for(let k=len;k<=str.length;k++) {
    const subStr = str.slice(i, k);
    if(/^[ACGT]+$/.test(subStr)) {
      const gcRatio = getGCRatio(subStr);
      if(gcRatio > res.gcRatio) {
        res.v = subStr;
        res.gcRatio = gcRatio;
      }
    }
    i++;
  }
  console.log(res.v);
}