#include<bits/stdc++.h> using namespace std; bool check(string s){ stack<char> st; int len = s.size(); for(int i=0;i<len;i++){ if(s[i]=='a'){ st.push(s[i]);//遇到a就先入栈 } else if(s[i]=='b'){ if(st.empty()){ return 0;// } st.pop();//遇到b就将a出栈 } } return st.empty();//遍历完后栈空就是好串,反之 } int main(){ string s; cin>>s; if(check(s)){ cout<<"Good"; }else{ cout<<"Bad"; } return 0; }