CCF Python题解(100分)201409-3 字符串匹配

CCF Python题解(100分)201409-3 字符串匹配

import re

s = input()
flag = input()  # 1大小写敏感
n = int(input())
for i in range(n):
    inputstr = input()
    if flag == '1':  # 大小写敏感
        if s in inputstr:
            print(inputstr)
    else:
        # 这几个方法都是生成新字符串,并不对原字符串做任何修改
        if s.upper() in inputstr.upper():
            print(inputstr)

猜你喜欢

转载自blog.csdn.net/qq_39577481/article/details/83988944