PAT_A1050#String Subtraction
Source:
Description:
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 1. 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.
Keys:
Code:
/*
Data: 2019-07-21 19:47:24
Problem: PAT_A1050#String Subtraction
AC: 08:34 题目大意:
给定字符串S和T,把T中的字符从S中删去
*/ #include<cstdio>
#include<string>
#include<iostream>
using namespace std;
char mp[]={}; int main()
{
#ifdef ONLINE_JUDGE
#else
freopen("Test.txt", "r", stdin);
#endif string s,t;
getline(cin,s);
getline(cin,t);
for(int i=; i<t.size(); i++)
mp[t[i]]=;
for(int i=; i<s.size(); i++)
if(mp[s[i]]==)
printf("%c", s[i]); return ;
}
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 1. 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.
PAT_A1050#String Subtraction的更多相关文章
- PAT 解题报告 1050. String Subtraction (20)
1050. String Subtraction (20) Given two strings S1 and S2, S = S1 - S2 is defined to be the remainin ...
- PAT 1050 String Subtraction
1050 String Subtraction (20 分) Given two strings S1 and S2, S=S1−S2 is defined to be t ...
- 1050 String Subtraction (20 分)
1050 String Subtraction (20 分) Given two strings S1 and S2, S=S1−S2 is defined to be the ...
- pat1050. String Subtraction (20)
1050. String Subtraction (20) 时间限制 10 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Giv ...
- pat 1050 String Subtraction(20 分)
1050 String Subtraction(20 分) Given two strings S1 and S2, S=S1−S2 is defined to be the ...
- PAT 甲级 1050 String Subtraction (20 分) (简单送分,getline(cin,s)的使用)
1050 String Subtraction (20 分) Given two strings S1 and S2, S=S1−S2 is defined to be t ...
- PAT甲级——1050 String Subtraction
1050 String Subtraction Given two strings S1 and S2, S=S1−S2 is defined to be the remain ...
- 1050. String Subtraction (20)
this problem is from PAT, which website is http://pat.zju.edu.cn/contests/pat-a-practise/1050. firs ...
- String Subtraction
Given two strings S1 and S2, S = S1 - S2 is defined to be the remaining string after taking all the ...
随机推荐
- 屏蔽浏览器默认样式 user agent stylesheet
user agent stylesheet <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" &q ...
- 使用js在页面上新建文件夹
使用js在页面上新建文件夹 <!DOCTYPE html> <html lang="en"> <head> <meta charset=& ...
- JavaFX教程
JavaFX是Java的下一代图形用户界面工具包.JavaFX是一组图形和媒体API,我们可以用它们来创建和部署富客户端应用程序. JavaFX允许开发人员快速构建丰富的跨平台应用程序.JavaFX通 ...
- Tomcat启动脚本(1)startup.bat
@echo off rem Licensed to the Apache Software Foundation (ASF) under one or more rem contributor lic ...
- __user表示是一个user mode的pointer,所以kernel不可能直接使用。
__user表示是一个用户空间的指针,所以kernel不可能直接使用. #ifdef __CHECKER__# define __user __attribute__((noderef, addres ...
- 【牛客网-剑指offer】跳台阶
题目: 一只青蛙一次可以跳上1级台阶,也可以跳上2级.求该青蛙跳上一个n级的台阶总共有多少种跳法(先后次序不同算不同的结果). 考点: 递归和循环 思路: 1)利用二叉树,左孩子为跳一级,右孩子为跳两 ...
- 微信小程序のwxs语言
一.wxs介绍 wxs是微信小程序自身的脚本语言,用来过滤和计算.wxs可以通过文件可模块标签来定义 文件需要.wxs后缀文件 二.实例 <wxs module="test1" ...
- 根据ThinkPHP官方文档学习opensns框架
根据ThinkPHP官方文档学习opensns框架 1.解读Application下各个Controller文件夹下的作用 控制器类的命名方式是:控制器名(驼峰法,首字母大写)+Controller ...
- shell浮点数运算
- RK3288编译 Android 5.1 固件
1 准备工作 编译 Android 对机器的配置要求较高: 64 位 CPU 16GB 物理内存+交换内存 30GB 空闲的磁盘空间用于构建,源码树另外占用大约 25GB Ubuntu 14.04 操 ...