简单题,不解释,就是要注意提交格式。

/*ID: nealgav1
PROG: ride
LANG: C++
*/
#include<cstdio>
#include<cstring>
int main()
{
freopen("ride.in","r",stdin);
freopen("ride.out","w",stdout);
char name[10],q[10];
int i,j,lenn,lenq;
while(scanf("%s%s",name,q)!=EOF)
{
lenn=strlen(name);
lenq=strlen(q);
int m=1,n=1;
for(i=0;i<lenn;i++)
m*=name[i]-'A'+1;
for(i=0;i<lenq;i++)
n*=q[i]-'A'+1;
if((m%47)==(n%47))
printf("GO\n");
else
printf("STAY\n");
}

return 0;
}