题解 | #参数解析#

参数解析

https://www.nowcoder.com/practice/668603dc307e4ef4bb07bcd0615ea677

inData = list(input())
cmds = []
while inData:
    i = inData.pop(0)
    if i == ' ':
        continue
    c = ""
    if i=='"':
        i = ""
        while i != '"':
            c += i
            i = inData.pop(0)
            
    else:
        c += i
        while i != ' ' and inData:
            i = inData.pop(0)
            c += i
    cmds.append(c)

print(len(cmds))
for i in cmds:
    print(i)


























全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务