#include <iostream>
using namespace std;

int main() {
    string str;
    cin>>str;
    int cnta=0,cntb=0;
    for(char c:str)
    {
        if(c=='A')
            cnta++;
        if(c=='B')
            cntb++;
    }
    if(cnta>cntb)
        cout<<'A';
    else if(cnta==cntb)
        cout<<'E';
    else cout<<'B';
}
// 64 位输出请用 printf("%lld")

这题根本就不用考虑以什么结束输入。

string解决一切!