//能过但肯定不是最优解
#include <iostream>
using namespace std;
#include <stack>
int main() {
string s;
stack<char> a;
stack<char> b;
cin>>s;
int flag=1;
for(int i=0;i<s.length();i++)
{
if(s[i]=='a')
{
a.push(s[i]);
}
else if(s[i]=='b')
{
if(a.empty())
{
cout<<"Bad";
flag=0;
break;
}
else {
a.pop();
}
}
else
{
cout<<"Bad";
flag=0;
break;
}
}
if(flag==1)
{
if(a.empty())
{
cout<<"Good";
}
else {
cout<<"Bad";
}
}
}
// 64 位输出请用 printf("%lld")

京公网安备 11010502036488号