题解 | #参数解析#
参数解析
http://www.nowcoder.com/practice/668603dc307e4ef4bb07bcd0615ea677
while True:
try:
s = input()
flag, temp, args = False, '', []
for c in s + ' ':
if c == '"':
# 如果遇到引号,若标志位flag被打开,则关闭;否则将其开启
flag = False if flag else True
continue
if c != ' ':
temp += c
else:
if flag:
temp += c
else:
args.append(temp)
temp = ''
print(len(args))
for a in args:
print(a)
except:
break