题解 | #在字符串中找出连续最长的数字串#

在字符串中找出连续最长的数字串

http://www.nowcoder.com/practice/2c81f88ecd5a4cc395b5308a99afbbec

while True:
    try:
        str_in = input()
        s=''
        for w in str_in:
            if w.isalpha():
                s+='*'
            else:
                s+=w
        s2=s.split('*')
        dic={}
        for w in s2:
            if w !='':
                dic[w]=len(w)
        max_value = max(dic.values())
        new_str =''
        for key in dic:
            if dic[key]==max_value:
                new_str+=key
        print(new_str+','+str(max_value))
               
    except:
        break
全部评论

相关推荐

ohs的小木屋:比不少实习待遇高了
点赞 评论 收藏
分享
lllllkin:感觉可以精简到一页简历,有些排版感觉不是必须的。 时间线越早的,你自己越熟悉的放前面。描述可以更精简些,一些问题解决感觉可以不用写具体技术栈,卖个关子,等面试官问。
点赞 评论 收藏
分享
评论
点赞
1
分享

创作者周榜

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