Python,通过了第2,4,两个测试点,请帮忙看看。
查看原帖
Python,通过了第2,4,两个测试点,请帮忙看看。
1226107
renliantao楼主2024/1/9 12:56

下载了错误的输入输出点,输入点里面是:td Td tLWCsrmt,只有一行,明明说好是输入两行的,这我怎么排错啊。

s1=input()
s2=input()
s1=s1.lower()
s2=s2.lower()
ss=s2.split()
count=0
location=0
repeat=0
temp_n=0
for i in range(0,len(ss)):
	if ss[i]==s1:
		count=count+1
		repeat=repeat+1
		if repeat==1:
			location=temp_n	
	temp_n=temp_n+len(ss[i])+1
if repeat<1:
	location=-1
	print(location)
else:
	print(count,end=" ")
	print(location)	

2024/1/9 12:56
加载中...