28 lines
592 B
Python
28 lines
592 B
Python
from collections import Counter
|
|
|
|
from icecream import ic
|
|
|
|
|
|
string: str = input()
|
|
max_weight = 0
|
|
|
|
def calculate_weight(counter: Counter[str], length: int) -> int:
|
|
max_occurence: int = counter.most_common(1)[0][1]
|
|
return max_occurence * length
|
|
|
|
counter: Counter[str] = Counter()
|
|
|
|
for length in range(1, len(string) + 1):
|
|
counter.clear()
|
|
counter.update(
|
|
string[i:i+length] for i in range(len(string) - length + 1)
|
|
)
|
|
# ic(counter)
|
|
max_weight: int = max(
|
|
max_weight,
|
|
calculate_weight(counter, length)
|
|
)
|
|
ic(max_weight)
|
|
|
|
print(max_weight)
|