#include <iostream>#include <string>using namespace std;int main(){ int z = 0; string i1, i2; cin >> i1; cin >> i2; for (char &c : i1) c = toupper(c); for (char &c : i2) c = toupper(c); if (i1<i2){z-=1;} else if(i1>i2){z+=1;} else {z = 0;} cout << z << '\n';return 0; }
z=0x=list(input().lower())y=list(input().lower())if x == y: z=0else: for e in x: index = x.index(e) if ord(x[index]) > ord(y[index]): z+=1;break elif ord(x[index]) < ord(y[index]): z-=1;breakprint(z)
Comments
solution.cpp
A slightly different solution than the python version