B1033旧键盘打字 (20 分)

#include <iostream>
#include <bits/stdc++.h>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
    
    
	
	string str1, str2;
//	cin >> str1 >> str2;
	getline(cin, str1);
getline(cin, str2);
	int len1 = str1.length();
	int len2 = str2.length();
	
	bool flag = true, isNull = true;
	
	for(int i = 0; i < len1; i++){
    
    
		if(str1[i] == '+'){
    
    
			flag = false;
			break;
		}
	}
	
	for(int i = 0; i < len2; i++){
    
    
	    int j = 0;
		char c1, c2;
		c2 = str2[i];
		
		if(flag == false) {
    
     //说明坏了 
			if(c2 >= 'A' && c2 <= 'Z') continue; 
		}
		
		if(c2 >= 'A' && c2 <= 'Z')  c2 += 32;  //大写转小写 
		for(j = 0; j < len1; j++){
    
    
			c1 = str1[j];
			
			if(c1 >= 'A' && c1 <= 'Z')  c1 += 32;
			
			if(c1 == c2) {
    
    
				break;
			}
		}
		if(j == len1){
    
    
			cout << str2[i];
			isNull = false;
		}
	} 
	
	if(isNull == true){
    
    
		//cout << endl;
		printf("\n");
	}
	
	return 0;
}

猜你喜欢

转载自blog.csdn.net/alovelypeach/article/details/114282366
今日推荐