zoukankan      html  css  js  c++  java
  • 1084 Broken Keyboard (20 分)

    On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters corresponding to those keys will not appear on screen.

    Now given a string that you are supposed to type, and the string that you actually type out, please list those keys which are for sure worn out.

    Input Specification:

    Each input file contains one test case. For each case, the 1st line contains the original string, and the 2nd line contains the typed-out string. Each string contains no more than 80 characters which are either English letters [A-Z] (case insensitive), digital numbers [0-9], or _ (representing the space). It is guaranteed that both strings are non-empty.

    Output Specification:

    For each test case, print in one line the keys that are worn out, in the order of being detected. The English letters must be capitalized. Each worn out key must be printed once only. It is guaranteed that there is at least one worn out key.

    Sample Input:

    7_This_is_a_test
    _hs_s_a_es
     

    Sample Output:

    7TI


    #include<bits/stdc++.h>
    using namespace std;
    const int maxn=100010;
    int book[maxn]={0};
    int main(){
        string s,t;
        cin>>s>>t;
        for(int i=0;i<t.length();i++){
            if(t[i]>='a'&&t[i]<='z'){
                t[i]-=32;
            }
            book[t[i]]=1;
        }
        for(int i=0;i<s.length();i++){
            if(s[i]>='a'&&s[i]<='z'){
                    s[i]-=32;
                }
            if(book[s[i]]==0){
                cout<<s[i];
                book[s[i]]=1;
            }
        }
        cout<<endl;
        return 0;
    }
  • 相关阅读:
    django框架个人博客实战
    django框架简介
    Nginx 反向代理设置
    Nginx 动静分离设置
    nginx 安装
    nginx-简介及概念
    自己的Qt GUI 项目+vs2013+opencv+caffe环境配置
    机器学习实战之K-Means算法
    机器学习实战之树回归
    机器学习实战之回归
  • 原文地址:https://www.cnblogs.com/dreamzj/p/14454558.html
Copyright © 2011-2022 走看看