const fs = require("fs");
const localFile = fs.existsSync("./input.txt");
const filePath = () => {
if (localFile) {
return "./input.txt";
}
return "/dev/stdin";
};
let input = fs.readFileSync(filePath()).toString().toUpperCase();
input = input.slice(0,input.length-1);
const countWordData = {};
const inspetedWord = [];
for(let i=0; i < input.length; i++){
if(inspetedWord.indexOf(input[i]) === -1){
inspetedWord.push(input[i]);
countWordData[input[i]] = 1;
} else {
countWordData[input[i]] = countWordData[input[i]] + 1;
}
}
let resultValue;
let repetitionCheck;
for(let key in countWordData){
if(repetitionCheck === undefined){
repetitionCheck = countWordData[key]
resultValue = key
} else {
if(countWordData[key] > repetitionCheck){
repetitionCheck = countWordData[key]
resultValue = key;
} else if(countWordData[key] === repetitionCheck){
resultValue = '?';
}
}
}
console.log(resultValue)