1. 程式人生 > >CCF Python題解(100分)201409-3 字串匹配

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)