112A: Petya and Strings

Problem link

<Source Code>

#include<stdio.h>
#include<string.h>
#include<ctype.h>
int main()
{char x[1000],y[10000],a[10000],b[10000];
long long n,i,l,j,c=0,co=0;scanf("%s",a);
{c=0,co=0;
scanf("%s",b);
	for(i=0;i<strlen(a);i++)
	{x[i]=toupper(a[i]);
	
		
	}
	
		for(j=0;j<strlen(b);j++)
	{y[j]=toupper(b[j]);
	co++;
		
	}
	
for(l=0;l<co;l++)
{
	if(x[l]>y[l])
	
	{
			printf("1\n");
			break;
	}
	else if(x[l]<y[l])
{	printf("-1\n");break;}
	else if(x[l]==y[l])
	{
		c++;
	}
}
	

if(c==co)

	printf("0\n");
	
}
	
	
}
Advertisements

About waprogramming

I am in CSE,from CUET
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s