| title | <Python><PAT> 1050 String Subtraction | ||||
|---|---|---|---|---|---|
| date | 2019-08-27 06:22:24 -0700 | ||||
| tags |
|
||||
| cover | http://pwb80dtf4.bkt.clouddn.com/PAT-cover.webp | ||||
| categories | PAT | ||||
| top_img | http://pwb80dtf4.bkt.clouddn.com/PAT-top.webp | ||||
| description | 字符串大水题 |
Given two strings
Each input file contains one test case. Each case consists of two lines which gives
For each test case, print
They are students.
aeiou
Thy r stdnts.
- 对第一行字符串的每个字符,如果它不在第二行当中,那么就输出它。
- 很显然用哈希集合。
- a是第一行,字符串
- b是一个哈希集和,存放第二行每一个字符。
- 先输入第一行
- 再输入第二行,建哈希集和
- 对每一个第一行的字符,判断其在不在第二行,不在就输出,注意后面不加空格。
- 因为使用Python能够AC,因此只放了Python的代码。
a = input()
b = set([i for i in input()])
for i in a:
if i not in b:
print(i, end='')