https://vjudge.net/contest/394066#problem/A
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <iomanip>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#include <iterator>
#include <utility>
#include <sstream>
#include <limits>
#include <numeric>
#include <functional>
using namespace std;
#define gc getchar()
#define mem(a) memset(a,0,sizeof(a))
#define debug(x) cout<<"debug:"<<#x<<" = "<<x<<endl;
#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef char ch;
typedef double db;
const double PI=acos(-1.0);
const double eps=1e-6;
const int inf=0x3f3f3f3f;
const int maxn=1e5+10;
const int maxm=100+10;
const int N=1e6+10;
const int mod=1e9+7;
char name[10] = {0};
char s[10] = {0};
int p0 = 0;
int p1 = 0;
int element0 = 0;
int element1 = 0;
int main()
{
int n = 0;
cin >> n;
cin >> name;
for(int i = 0;i<n;i++)
{
cin >> s;
bool null_flag = 0;
p0 = p1 = 0;
bool if_answered = 0;
while(!null_flag)
{
bool type = 0;
element0 = element1 = 0;
if(name[p0] >= '0' && name[p0] <= '9')
{
while(name[p0] >= '0' && name[p0] <= '9')
{
element0 = element0*10 + name[p0]-'0';
//cout<<endl<<"E0 "<<element0<<endl;//
p0 += 1;
}
//cout<<"!1 ";//
type = 1;
}
else if(name[p0] >= 'a' && name[p0] <= 'z' || name[p0] >= 'A' && name[p0] <= 'Z')
{
element0 = name[p0];
p0 += 1;
}
if(s[p1] >= '0' && s[p1] <= '9')
{
if(!type)
{
cout << "-" <<endl;
if_answered = 1;
break;
}
while(s[p1] >= '0' && s[p1] <= '9')
{
element1 = element1*10 + s[p1]-'0';
p1 += 1;
}
//cout<<"!2 ";
}
else if(s[p1] >= 'a' && s[p1] <= 'z' || s[p1] >= 'A' && s[p1] <= 'Z')
{
if(type)
{
cout << "+" <<endl;
if_answered = 1;
break;
}
element1 = s[p1];
p1 += 1;
}
//cout << element0 << " "<< element1<<endl;//
if(element0 < element1)
{
cout << "+" <<endl;
if_answered = 1;
break;
}
else if(element0 >element1)
{
cout << "-" <<endl;
if_answered = 1;
break;
}
if(name[p0] == '\0' || s[p1] == '\0')
{
null_flag = 1;
}
}
if(!if_answered)
{
if(name[p0] == '\0' && s[p1] != '\0')
cout << "+" <<endl;
if(name[p0] != '\0' && s[p1] == '\0')
cout << "-" <<endl;
if(name[p0] == '\0' && s[p1] == '\0')
cout << "+" <<endl;
}
}
return 0;
}