#include <stdio.h> #include <string.h> #include <stdlib.h> int isGC(char a) { if(a == 'G' || a == 'C') return 1; return 0; } int main() { char input[1001]; int n; while (scanf("%s\n%d", input, &n) != EOF) { int len = strlen(input); int substrnum = len - n; float *ratio = (float *)malloc((substrnum) * sizeof(float)); int maxratioindex = 0; for(int i = 0; i < substrnum; i++) { ratio[i] = 0; for(int j = 0; j < n; j++) { ratio[i] += isGC(input[i + j]); } ratio[i] /= n; if(ratio[i] > ratio[maxratioindex]) { maxratioindex = i; } } for(int i = maxratioindex; i < maxratioindex + n; i++) { printf("%c", input[i]); } } return 0; }