题解 | #子串计算#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)

全部评论

相关推荐

02-22 21:16
已编辑
门头沟学院 运营
牛客928043833号:离了你谁还拿我当个宝
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务