题解 | #子串计算#Python版代码

子串计算

https://www.nowcoder.com/practice/bcad754c91a54994be31a239996e7c11

from collections import Counter
s = input()
counter = Counter(s[i:j] for i in range(len(s)) for j in range(i + 1, len(s) + 1))
for num, count in sorted(counter.items()):
    if (count > 1): print(num, count)

全部评论

相关推荐

下北澤大天使:你是我见过最美的牛客女孩😍
点赞 评论 收藏
分享
05-26 22:25
门头沟学院 Java
Java小肖:不会是想叫你过去把你打一顿吧,哈哈哈
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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