Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ID: mickyta1
- TASK: ride
- LANG: C++
- */
- #include <bits/stdc++.h>
- using namespace std;
- const int N = 6;
- const int MD = 47;
- char strA[N + 1], strB[N + 1];
- int main(){
- freopen("ride.in", "r", stdin);
- freopen("ride.out", "w", stdout);
- scanf(" %s %s", strA, strB);
- int lenA = strlen(strA);
- int proA = 1;
- for(int i = 0; i < lenA; ++i){
- proA = proA * (strA[i] - 'A' + 1) % MD;
- }
- int lenB = strlen(strB);
- int proB = 1;
- for(int i = 0; i < lenB; ++i){
- proB = proB * (strB[i] - 'A' + 1) % MD;
- }
- if(proA == proB){
- cout << "GO\n";
- } else {
- cout << "STAY\n";
- }
- fclose(stdin);
- fclose(stdout);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement