我的个人网站 Cheese的个人主页http://www.cheese.ren/
博客来源 PAT 乙级 1033 旧键盘打字-Cheese的个人博客PAT 乙级 1033 旧键盘打字http://blog.cheese.ren/53
欢迎交换友链 :-)
#include <bits/stdc++.h>
using namespace std;
int main() {
string bad_char;
getline(cin, bad_char);
bool not_large=false, bad_flag[1000]={false};
for (int i=0; i<bad_char.length(); i++) {
if (bad_char[i] == '+')
not_large = true;
bad_flag[bad_char[i]] = true;
}
string str;
getline(cin, str);
for (int i=0; i<str.length(); i++) {
char temp=str[i];
if (not_large)
if (str[i] >= 'A' && str[i] <= 'Z')
temp = ' ';
if (str[i] >= 'a' && str[i] <= 'z')
temp = str[i] - 32;
if (bad_flag[temp])
temp = ' ';
if (temp != ' ')
printf("%c", str[i]);
}
printf("\n");
return 0;
}