17: String, 17: String

Source: Internet
Author: User

17: String, 17: String
17: String judgment

  • View
  • Submit
  • Statistics
  • Question
Total time limit:
1000 ms
 
Memory limit:
65536kB
Description

Determines whether two strings consisting of uppercase and lowercase letters and spaces are equal after the case is ignored and spaces are ignored.

Input
Two rows. Each row contains a string.
Output
If the two strings are equal, YES is output; otherwise NO is output.
Sample Input
a A bb BB ccc CCCAa BBbb CCCccc
Sample output
YES

# Include <iostream> # include <cstdio> # include <cstring> using namespace std; char a [100001]; char B [100001]; char a1 [10001]; int now1; char b1 [10001]; int now2; int now = 0; int main () {gets (a); gets (B); int la = strlen (); int lb = strlen (B); for (int I = 0; I <la; I ++) {if (a [I]> = 97 & a [I] <= 122) a [I] = a [I]-32 ;}for (int I = 0; I <lb; I ++) {if (B [I]> = 97 & B [I] <= 122) B [I] = B [I]-32;} // convert all lowercase letters to uppercase for (int I = 0; I <= la; I ++) {if (a [I]! = '') {A1 [now1] = a [I]; now1 ++ ;}}for (int I = 0; I <= lb; I ++) {if (B [I]! = '') {B1 [now2] = B [I]; now2 ++;} int la1 = strlen (a1); int lb1 = strlen (b1 ); if (la1! = Lb1) {cout <"NO"; return 0 ;}else {for (int I = 1; I <= la1; I ++) {if (a1 [I]! = B1 [I]) {cout <"NO"; return 0 ;}} cout <"YES" ;}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.