python 过了 参考吧
查看原帖
python 过了 参考吧
520962
zwh190楼主2021/11/22 19:47
f = input().strip().lower()
s = input().lower()
cot = s.split().count(f)
lf = len(f)
for i  in range(len(s)):
    if s[i] == f[0]:
        if s[i:i+lf] ==  f and s[i+lf]==' ' and s[i-1]==' ' or i-1 == 1:
            print(cot, i)
            break
else:
    print(-1)

2021/11/22 19:47
加载中...