#include <stdio.h>

int main() {
    char str[1000001];
    int alp[26]={0};
    int alp_idx, max=0, max_idx=0;
    scanf("%s",str);
    for (int i=0 ;str[i] ;i++) {
        alp_idx=str[i];
        //입력 받은거 대문자로 정리
        if (alp_idx>=97 && alp_idx<=122) alp_idx-=32;
        //알파벳 갯수만큼 +1하기
        alp[alp_idx-65]+=1;
    }
    //가장 많은 알파벳 찾기
    for (int i=0; i<26; i++) {
        if(max<alp[i]) {
            max=alp[i];
            max_idx=i;
        }
    }
    
    int cnt=0;
    for (int i=0; i<26; i++) {
        if (max==alp[i]) cnt++;
    }
    if (cnt > 1) {
        printf("?\n"); // 최대 빈도가 2개 이상일 때 '?' 출력
    } else {
        printf("%c\n", max_idx + 'A'); 
    }
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: