大于输出1,小于是-1,相等是0.
刚好C++的STL里有string的逻辑运算符重载,直接==、>、<就可以比较了 (注意,string的比较似乎是和大小写相关的所以我们要把它变成全大写或者全小写)
Code:
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
// http://codeforces.com/contest/112
// Petya and Strings
int main()
{
string a,b; cin>>a>>b;
for(int i=0;i<a.length();i++)
{
a[i]=tolower(a[i]);
b[i]=tolower(b[i]);
}
if(a==b) cout<<0;
else if(a>b)cout<<1;
else cout<<-1;
return 0;
}