#include <iostream>
using namespace std;
int main() {
char word[1000001]={" ",};
char mostAlpha[26]={" ",}; //์ํ๋ฒณ ๊ฐฏ์๊ฐ 26๊ฐ์ด๋ฏ๋ก
int repetNum[26]={0,}; //๋๋ฌธ์ ์๋ฌธ์ ํฉํ๋ฉด 52
int idx=0,alphaCount=0;
bool isIncrease=false;
scanf("%s",word);
while(word[idx]!='\0'){
int idxSame=0;
if(word[idx]>=97) word[idx]-=32; //์๋ฌธ์์ผ ๊ฒฝ์ฐ ์์คํค์ฝ๋ 32๋ฅผ ๋นผ์ฃผ์ด ๋๋ฌธ์๋ก ๋ณํ
if(alphaCount>=1){
for(int i=0;i<alphaCount;i++){
//๊ฐ์ ๊ฒ ์๋์ง ์ฒดํฌ ๋ฐ ๊ฐ์ ์๋ฆฌ์ ๋ฐฐ์ด ๋ฒํธ ์ ์ฅ
if(word[idx]==mostAlpha[i]){
isIncrease=false;
idxSame=i;
break;
}
else{
isIncrease=true;
}
}
if(isIncrease){ //for๋ฌธ์ด ๋๋๊ณ alphaCount๋ฅผ ๋ํด์ฃผ์ด์ผํ๊ธฐ ๋๋ฌธ
mostAlpha[alphaCount]=word[idx];
repetNum[alphaCount]=1;
alphaCount++; //๊ทธ๋ ์ง ์์ผ๋ฉด ๋ ๋ง์ for๋ฌธ์ ๋ฐ์์ํด
}
else
{
repetNum[idxSame]++; //์๋๋ฉด์ ๊ฐ์๊ฒ์ ++ํด์ค
}
}
else
{
mostAlpha[0]=word[idx];
repetNum[0]=1;
alphaCount++;
}
idx++;
}
//์ ์ผ ์ซ์๊ฐ ํฐ ๊ฒ์ ๋ฝ์
int mostNum=0,mostNumIdx=0;
bool isDupli=false;
for(int i=0;i<alphaCount;i++){
if(mostNum<repetNum[i]){
mostNum=repetNum[i];
isDupli=false; //์ต๋๊ฐ์ด ๋ฐ๋๊ฒฝ์ฐ false
mostNumIdx=i;
}
else if(mostNum==repetNum[i]&&repetNum[i]>1){
isDupli=true; //๊ฐ์ ์ต๋๊ฐ์ด ์๋ค๋ฉด true, ํ์ง๋ง 1์ด๊ณผ์ฌ์ผํจ
}
}
if(isDupli){
printf("?");
}
else{
printf("%c",mostAlpha[mostNumIdx]);
}
return 0;
}