Your Ride Is Here
阿新 • • 發佈:2020-12-27
技術標籤:USACO
/* Use the slash-star style comments or the system won't see your
identification information */
/*
ID: lincans1
LANG: JAVA
TASK: ride
*/
import java.io.*;
import java.util.Scanner;
class ride {
public static int count(String str) {
int num = 1;
for (char ch : str.toCharArray( )) {
num *= (ch - 'A' + 1);
}
return num;
}
public static void main(String[] args) throws IOException, Exception {
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("ride.out")));
Scanner in = new Scanner(new File("ride.in"));
String comet = in.next(), team = in.next();
int comet_num = count(comet);
int team_num = count(team);
if (comet_num % 47 == team_num % 47) {
out.println("GO");
}
else {
out.println("STAY");
}
in.close();
out.close();
}
}