You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
443 B
C++

#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main()
{
char buf[10];
scanf("%s", buf);
int a = 1;
for (char *p = buf; *p; p++)
a = a * (*p - 'A' + 1) % 47;
scanf("%s", buf);
int b = 1;
for (char *p = buf; *p; p++)
b = b * (*p - 'A' + 1) % 47;
puts(a == b ? "GO" : "STAY");
return 0;
}