POJ Hundred refining and research machine test 2743: string sentence, etc.

Source: Internet
Author: User
Tags first string time limit
2743: string sentence, etc.View the total time limit for submitting statistics tips: 1000ms memory limit: 65536kB description Determines whether two strings consisting of uppercase and lowercase letters and spaces are equal after ignoring the case and compressing the spaces the input line 1th is the number of groups n for the test data, 2 rows for each set of test data, and the 1th line is the first string S1, line 2nd is the second string S2.
There is a blank row between each set of test data, with no more than 100 characters per row (note that the length of the string may be 0) output n rows, equal output Yes, otherwise output no sample input
3



a BB bb CCC CCC
Aa bbbb CCCCCC

a              dfadf              fasdf
Adasddfsfsaf
Sample output
Yes
Yes
NO
#include <stdio.h>
#include <string.h>
int main () {
	int n;
	Char str1[110],str2[110];
	Char ctr1[110],ctr2[110];
	scanf ("%d", &n); GetChar ();
	for (int i=0;i<n;i++) {
		str1[0]= ']; str2[0]= ';
		ctr1[0]= ' ctr2[0]=
		'; Gets (STR1);
		Gets (STR2);
		GetChar ();
		if (i!=n-1) GetChar ();
		int i1=0,i2=0;
		int Num1=strlen (STR1);
		int Num2=strlen (STR2);
		for (int i=0;i<num1;i++) {
			if (str1[i]!= ') {	
				if (str1[i]>= ' A ' &&str1[i]<= ' Z ')
			    ctr1[ i1++]=str1[i]+32;
			    else ctr1[i1++]=str1[i];
			}	Ctr1[i1]= ' ";
		for (int i=0;i<num2;i++) {
			if (str2[i]!= ') {
				if (str2[i]>= ' A ' &&str2[i]<= ' Z ')
			    ctr2[ i2++]=str2[i]+32;
				else ctr2[i2++]=str2[i];
			}	Ctr2[i2]= '//printf ' ("%s\n%s\n", ctr1,ctr2);
		if (strcmp (CTR1,CTR2) ==0) {
			printf ("yes\n");
		} else printf ("no\n");
	}
return 0;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.