Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #букв английского алфавита, десятичных цифр и пробелов
- alph = 'abcdefghijklmnopqrstuvwxyz' + ' ' + '0123456789'
- met = {}
- for l in alph:
- met[l] = -1
- s = input()
- n = len(s)
- l = 0
- r = 0
- met[s[0]] = 0
- maxl = 1
- r += 1
- while r < n:
- while met[s[r]] >= l and l + 1 < n:
- l += 1
- met[s[l]] = l
- cur = r - l + 1
- maxl = max(maxl, cur)
- met[s[r]] = r
- r += 1
- print(maxl)
- #pwwkEw
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement