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)
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)