[C/C++]
#include <bits/stdc++.h>
using namespace std;
const int N = 102;
char s[22], queA[N], queB[N];
int headA, headB, tailA, tailB, n;
int main()
{
cin >> s;
n = ______(1)______;
for (int i = 0; i < n; i++)
{
if (___(2)___)
{
queA[tailA] = i;
tailA++;
}
else
{
queB[tailB] = i;
tailB++;
}
}
while (_____(3)_____)
{
if (queA[headA] < queB[headB])
{
queA[tailA] = queA[headA] + n;
tailA++;
}
else
{
queB[tailB] = queB[headB] + n;
tailB++;
}
headA++;
headB++;
}
if (_____(4)_____)
cout << 'B';
else
cout << 'A';
return 0;
}
[Python]
s=input()
queA=[""]*100
queB=[""]*100
headA=headB=0
tailA=tailB=0
n=len(s)
for i in range(n):
if _____(1)______:
queA[tailA]=i
tailA+=1
else:
queB[tailB]=i
tailB+=1
while _____(2)_________:
if queA[headA]<queB[headB]:
queA[tailA]=queA[headA]+n
tailA+=1
else:
queB[tailB]=queB[headB]+n
tailB+=1
headA+=1; headB+=1
if _____(3)_______:
print('B')
else:
print('A')