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;
    }
  • 相关阅读:
    Git仓库操作笔记[Git repositories]
    supervisor 使用
    python动态加载(二)——动态加载类
    python动态加载(一)——加载方法
    python连接hdfs常用操作
    python对文件进行并行计算初探
    python加载包顺序和PYTHONPATH
    python实现读取数据库的断点续传
    python实现读取文件的断点续传
    python启动一个新进程
  • 原文地址:https://www.cnblogs.com/dreamzj/p/14454558.html
Copyright © 2011-2022 走看看