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 ;}