{% tabs %} {% tab title="Go" %}
package main
import (
"fmt"
)
func helper(S string)(int){
ans := 1
for _, c := range S {
ans*= int(c - 'A' + 1)% 47
}
return ans%47
}
func main() {
var A, B string
fmt.Scanf("%s\n%s", &A,&B)
// fmt.Printf(A)
// fmt.Printf(B)
if (helper(A) == helper(B)){
fmt.Printf("GO")
}else{
fmt.Printf("STAY")
}
}
{% endtab %}
{% tab title="c++" %}
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int helper(string s){
int ans = 1;
for (char c:s){
ans *= (c - 'A' + 1) % 47;
}
return ans% 47;
}
string A,B;
int main() {
cin >> A >> B;
if (helper(A) == helper(B)){
cout << "GO" << endl;
}
else {
cout << "STAY" << endl;
}
return 0;
}
{% endtab %}
{% tab title="Python" %}
def helper(s):
ans = 1
for c in s:
ans *= (ord(c) - ord("A") + 1)
return ans%47
A = input()
B = input()
if helper(A) == helper(B):
print("GO")
else:
print("STAY")
{% endtab %} {% endtabs %}