zoukankan      html  css  js  c++  java
  • pat1050. String Subtraction (20)

    1050. String Subtraction (20)

    时间限制
    10 ms
    内存限制
    65536 kB
    代码长度限制
    16000 B
    判题程序
    Standard
    作者
    CHEN, Yue

    Given two strings S1 and S2, S = S1 - S2 is defined to be the remaining string after taking all the characters in S2 from S1. Your task is simply to calculate S1 - S2 for any given strings. However, it might not be that simple to do it fast.

    Input Specification:

    Each input file contains one test case. Each case consists of two lines which gives S1 and S2, respectively. The string lengths of both strings are no more than 104. It is guaranteed that all the characters are visible ASCII codes and white space, and a new line character signals the end of a string.

    Output Specification:

    For each test case, print S1 - S2 in one line.

    Sample Input:
    They are students.
    aeiou
    
    Sample Output:
    Thy r stdnts.
    

    提交代码

     1 #include<cstdio>
     2 #include<algorithm>
     3 #include<iostream>
     4 #include<cstring>
     5 #include<queue>
     6 #include<vector>
     7 #include<cmath>
     8 #include<string>
     9 #include<map>
    10 #include<set>
    11 using namespace std;
    12 bool ha[128];//ACSII码范围  0-127
    13 int main(){
    14     //freopen("D:\INPUT.txt","r",stdin);
    15     string s1,s2,s3;
    16     getline(cin,s1);
    17     getline(cin,s2);
    18     int i;
    19     for(i=0;i<s2.length();i++){
    20         ha[s2[i]]=true;
    21     }
    22     s3="";
    23     for(i=0;i<s1.length();i++){
    24         if(!ha[s1[i]]){
    25             s3=s3+s1[i];
    26         }
    27     }
    28     cout<<s3<<endl;
    29     return 0;
    30 }
  • 相关阅读:
    bzoj3809
    bzoj2038
    bzoj1113
    oralce 知识
    oracle 12c安装详细教程
    oracle 知识点
    oracle 面试题
    PLSQL Developer工具的使用
    使用net Manager工具配置远程连接oracle
    vnc安装
  • 原文地址:https://www.cnblogs.com/Deribs4/p/4771704.html
Copyright © 2011-2022 走看看