This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
n = int(input())
s = input()
alph = "abcdefghijklmnopqrstuvwxyz"
def m(s):
max = 0
min = 10**7
for i in range(0, len(alph)):
e=s.count(alph[i])
if e == 0:
continue
if e>max:
max = e
if e<min:
min = e
return max-min
greatest = 0
for i in range(0, n):
for j in range(i+1, n+1):
r = m(s[i:j])
if r>greatest:
greatest = r
print(greatest)
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |