标签:str stream main ice class 提交 ati std type
判断两个由大小写字母和空格组成的字符串在忽略大小写,且忽略空格后是否相等。
a A bb BB ccc CCC Aa BBbb CCCccc
YES
#include <iostream> #include <algorithm> #include <stdio.h> #include <string> #include <ctype.h> using namespace std; int main() { char a[101]; char b[101]; gets(a); gets(b); string aa, bb; aa = a; bb = b; char aaa[101]; char bbb[101]; for(int i = 0; i < aa.size(); i++) { aa[i] = tolower(aa[i]); } for(int i = 0; i < bb.size(); i++) { bb[i] = tolower(bb[i]); } string f = " "; int t = aa.find(f, 0); while(t != string::npos) { aa.erase(t, 1); t = aa.find(f, 0); } t = bb.find(f, 0); while(t != string::npos) { bb.erase(t, 1); t = bb.find(f, 0); } if(aa == bb) printf("YES"); else printf("NO"); return 0; }
标签:str stream main ice class 提交 ati std type
原文地址:http://www.cnblogs.com/QingHuan/p/7105044.html