You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
723 B

#include <bits/stdc++.h>
using namespace std;
/*
uvwxyzabcdefghijklmnopqrst
5
apple banana
banana blueberry
apple watermelon
vegetable banana
apple ap
*/
string s; // uvwxyzabcdefghijklmnopqrst 给定的字典序
char get(char x) { // x=a-->g b--->h
return s.find(x) + 'a';
}
string change(string s1) {
string s2;
for (int i = 0; i < s1.size(); i++) s2 += get(s1[i]);
return s2;
}
int main() {
cin >> s;
int m;
cin >> m;
while (m--) {
string s1, s2;
cin >> s1 >> s2;
if (change(s1) < change(s2)) //s1==s2 => red
cout << "green" << endl;
else
cout << "red" << endl;
}
return 0;
}