/*
ID: marshall.1
LANG: JAVA
TASK: ride
*/
import java.util.*;
import java.io.*;
public class ride
{
public static void main(String [] args) throws IOException {
BufferedReader f = new BufferedReader(new FileReader("ride.in"));
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("ride.out")));
String comet = f.readLine();
String group = f.readLine();
String[] list_alpha = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
ArrayList list = new ArrayList(Arrays.asList(list_alpha));
int comet_num=1;
int group_num=1;
for (int x = 0 ; x < comet.length() ; x++)
{
comet_num *= list.indexOf((comet.substring(x, x+1)))+1;
}
for (int x = 0 ; x < group.length() ; x++)
{
group_num *= list.indexOf((group.substring(x, x+1)))+1;
}
if ((comet_num % 47) == (group_num % 47)){
out.println("GO");
}
else out.println("STAY");
out.close();
System.exit(0);
}
}
}
-runiteking1
Got comments? Post them below!
5 months ago
No comments:
Post a Comment