/*
ID: ahmedye1
PROG: ride
LANG: C++
*/
#include <iostream>
#include <fstream>
using namespace std;

int main()
{
ifstream inputFile (“ride.in”);
ofstream outputFile (“ride.out”);
string groupName;
string cometName;
int groupNum = 1;
int cometNum = 1;

if (inputFile.is_open())
{
inputFile >> cometName >> groupName;

for (int i = 0; i < cometName.length(); i++)
cometNum *= int (cometName[i] – 64);

for (int i = 0; i < groupName.length(); i++)
groupNum *= int (groupName[i] – 64);

if (groupNum % 47 == cometNum % 47)
outputFile << “GO” << endl;
else
outputFile << “STAY” << endl;
}

return 0;
}

Advertisements