Codeforces Petya and Strings

#include<iostream>
#include<cstring>
#include<string>
#include<cstdio>
#include<cmath>
#include<vector>
#include<map>

#define sf scanf
#define pf printf

using namespace std;

char ek[1100] , dui[1100];

int main()
{
    while(~sf("%s %s" , &ek, &dui))
    {
        int eklen = strlen(ek) , duilen = strlen(dui) , i;
        for(i=0; i<eklen; i++)
        {
            if(ek[i] >='A' and ek[i]<='Z')
            {
                ek[i] = ek[i] + 32;
            }
        }

        for(i=0; i<duilen; i++)
        {
            if(dui[i]>='A' and dui[i]<='Z')
            {
                dui[i] = dui[i] + 32;
            }
        }

        int r = strcmp(ek, dui);
        cout << r << '\n';
    }

    return 0;
}

Comments

Popular posts from this blog

SPOJ-CMG - Collecting Mango

LightOJ 1009 - Back to Underworld

LeetCode Palindrome Number