华为机试HJ74-又忙了好几天没刷题了

参数解析

http://www.nowcoder.com/questionTerminal/668603dc307e4ef4bb07bcd0615ea677

测试用例m='xcopy /s "C:\program files" "d:"'
其他都在代码里了

while True:
    try:
        m=input().split()
        result=[]
        count=0
        i=0
        while i in range(0,len(m)):
            if m[i].count('"')==2:
                result.append(m[i].replace('"',''))
                count+=1
                i+=1
            elif m[i].count('"')==1:
                j=0
                temp=m[i].replace('"','')
                for j in range(i+1,len(m)):
                    if m[j].count('"')==1:
                        count+=1
                        temp=temp+m[j].replace('"','')
                        break
                    else:
                        temp=temp+m[j].replace('"','')
                result.append(temp.replace('"',''))
                count+=1
                i=j+1
            else:
                result.append(m[i].replace('"',''))
                count+=1
                i+=1
        print(count)
        for i in result:
            print(i)
    except:
        break
全部评论

相关推荐

有气魄的马来熊在摸鱼:我爱vivo 马上换手机 vivo我爱你!!!
点赞 评论 收藏
分享
程序员牛肉:继续沉淀吧同学,你这就是纯纯的流水线产品。 差不多的学历+两个烂大街项目。自身学历又不行,现在找啥实习呢。有点太浮躁了。多花点心思搞搞ai,开源和八股。这比你这段时间捣鼓一段小厂实习要好得多;
点赞 评论 收藏
分享
评论
1
2
分享

创作者周榜

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