Codeforces “112A-Petya & Strings” solution( Bangla ) | Cpp language

**Before watching this make sure that you’ve tried enough**

#include<iostream>
#include<string>
using namespace std;
int main()
{
    string a,b;
    int i;
    cin>>a>>b;
    for(i=0; i<a.size(); i++)
    {
        a[i]=towlower(a[i]);
        b[i]=towlower(b[i]);
    }
    if(a==b)
        cout<<"0"<<endl;
    else
    {
        for(i=0; i<a.size(); i++)
        {
            if(a[i]<b[i])
            {
                cout<<"-1"<<endl;
                break;
            }
            if(a[i]>b[i])
            {
                cout<<"1"<<endl;
                break;
            }
        }
    }
}

 

If this solution helped you, please share this with your friends.

Leave a Comment