标签:printf pre ram 模拟 时间 div continue style cst
判断两个由大小写字母和空格组成的字符串在忽略大小写,且忽略空格后是否相等。
a A bb BB ccc CCC Aa BBbb CCCccc
YES
思路:
大模拟;
来,上代码:
#include<cstdio> #include<string> #include<cstring> using namespace std; int len_1,len_2,now_1=0,now_2=0; char word_1[100],word_2[100]; inline char char_(char &char__) { if(char__<=‘z‘&&char__>=‘a‘) char__-=32; } int main() { gets(word_1); gets(word_2); len_1=strlen(word_1),len_2=strlen(word_2); for(int i=0;i<=len_1;i++) char_(word_1[i]); for(int i=0;i<=len_2;i++) char_(word_2[i]); while(now_1<100||now_2<100) { if(word_1[now_1]==‘ ‘) { now_1++; continue; } if(word_2[now_2]==‘ ‘) { now_2++; continue; } if(word_1[now_1]!=word_2[now_2]) { printf("NO\n"); return 0; } now_1++,now_2++; } printf("YES\n"); return 0; }
标签:printf pre ram 模拟 时间 div continue style cst
原文地址:http://www.cnblogs.com/IUUUUUUUskyyy/p/6105063.html