@inkysakura
2017-05-18T13:29:48.000000Z
字数 892
阅读 1310
CODE
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
char s[55];
int dp[2][55][10];
int ncase;
bool judge(char c)
{
if(c=='A'||c=='E'||c=='I'||c=='O'||c=='U')
return true;
return false;
}
int main()
{
int t;
cin >>t;
while(t--)
{
int good=0,bad=0;
memset(dp,0,sizeof(dp));
cin >> s+1;
int len=strlen(s+1);
dp[0][0][0]=dp[1][0][0]=1;
for(int i=1;i<=len;i++)
{
for(int j=1;j<=3;j++)
{
if(!dp[0][i-1][j-1])continue;
if(s[i]=='?')
dp[0][i][j]=dp[1][i][1]=1;
else if(judge(s[i]))
dp[0][i][j]=1;
else
dp[1][i][1]=1;
}
if(dp[0][i][3]==1)
bad=1;
for(int j=1;j<=5;j++)
{
if(!dp[1][i-1][j-1])continue;
if(s[i]=='?')
dp[0][i][1]=dp[1][i][j]=1;
else if(judge(s[i]))
dp[0][i][1]=1;
else
dp[1][i][j]=1;
}
if(dp[1][i][5]==1)
bad=1;
}
for(int i=1;i<3;i++)
if(dp[0][len][i])good=1;
for(int i=1;i<5;i++)
if(dp[1][len][i])good=1;
cout <<"Case "<<++ncase<<": ";
if(good&&bad)cout<<"MIXED"<<endl;
else if(bad)cout<<"BAD"<<endl;
else cout <<"GOOD"<<endl;
}
return 0;
}