题解 | 参数解析
参数解析
https://www.nowcoder.com/practice/668603dc307e4ef4bb07bcd0615ea677
s=input()
s=s+'\n' #在输入字符串末尾加入一个换行符,以便提取最后一个操作
l=[]
tmp=0
i=0
while i < len(s):
if s[i]=='"':
tmp=s.index('"',i+1) # 找下一个引号出现的位置
l.append(s[i+1:tmp]) # 将引号内的内容加入到结果数组中
tmp+=2
i=tmp
elif s[i]==' ' or s[i]=='\n':
l.append(s[tmp:i])
i+=1
tmp=i
else:
i+=1
print(len(l))
for i in l:
print(i)