java problem: Petya and Strings, Little Petya loves presents. His mum bought him two strings of the same size for his birthday. The strings consist of uppercase and lowercase Latin letters. Now Petya wants to compare those two strings
- برمجة سي بلس بلس
- 2022-04-04
- owis1234
الأجوبة
#include <bits/stdc++.h>
using namespace std;
int main()
{
string s,x;
cin>>s>>x;
for(int i=0;i<s.size();i++)
{
if(tolower(s[i]) - 0 > tolower(x[i]) - 0)
{
cout<<1<<endl;
return 0;
}
else if(tolower(s[i]) - 0 < tolower(x[i]) - 0)
{
cout<<-1<<endl;
return 0;
}
}
cout<<0<<endl;
}
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال