2025-06-01 20:10:44 +09:00

18 lines
374 B
JavaScript

const n = require("fs").readFileSync(0,"utf8").toString().toUpperCase();
let arr = new Array(26).fill(0);
for(let c of n){
arr[c.charCodeAt()-'A'.charCodeAt()]++;
}
let max_idx = 0, cnt = 0;
for(let i=0; i<26; i++){
if(arr[i]==Math.max(...arr)){
max_idx=i;
cnt++;
}
}
console.log(cnt>1 ? '?' : String.fromCharCode('A'.charCodeAt()+max_idx));