题解 | #参数解析#

参数解析

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

s = input()
res = []
temp = ""
i = 0
while i < len(s):
    if s[i] == " ":
        res.append(temp)
        temp = ""
    elif s[i] == '"':
        i += 1
        while s[i] != '"':
            temp += s[i]
            i += 1
    else:
        temp += s[i]
    i += 1
res.append(temp)
print(len(res))
print("\n".join(res))

全部评论

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务