题目概述:
将一串文字用另一串 文字替代,并且不区分大小写
第一行:输入要替换的语句个数
第二行:原始句子1
第三行:替换语句1
第四行:原始句子2
第五行:替换语句2
第六行:原始句子3
第七行:替换语句3
······
s = 输入原始文字段
eg:
2
hello world
i am bad
i don not like you
I really like you at all
Hello world,i just want to tell you that i don not like you
return
i am bad,i just want to tell you that I really like you at all
'''
Author: 365JHWZGo
Description:
Date: 2021-09-20 15:55:08
FilePath: \Python\demo3.py
LastEditTime: 2021-09-20 17:18:39
LastEditors: 365JHWZGo
'''
import re
# print(re.sub('test', 'xxxx', 'Testing', flags=re.IGNORECASE))
num = int(input())
ori = [] #原始文字
rep = [] #替换文字
for i in range(num):
ori.append(input())
rep.append(input())
s = input()
for i in range(len(ori)):
if ori[i].lower() in s.lower():
s = re.sub(ori[i], rep[i], s, flags=re.IGNORECASE) #将ori[i]用rep[i]将s替换,并且忽略大小写
print(s)