PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#PS0000150. Xâu con dài nhất có từng nguyên âm xuất hiện chẵn lần (Find the Longest Substring Containing Vowels in Even Counts)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Xâu con dài nhất có từng nguyên âm xuất hiện chẵn lần (Find the Longest Substring Containing Vowels in Even Counts)

Find the Longest Substring Containing Vowels in Even Counts

Source: LeetCode

Version: Phuoc Hung OJ Extended

Problem Statement

Given a lowercase English string ss, find the maximum length of a contiguous substring in which each of a, e, i, o, u occurs an even number of times. Zero occurrences count as even. If no nonempty substring qualifies, the result is 0.

Input

One line containing the string ss of length nn.

Output

Print the maximum length as one integer.

Subtasks

  • Subtask 1 (20 points): 1≤n≤5001\le n\le 500; n=∣s∣n=|s|; the characters of ss belong to abcdefghijklmnopqrstuvwxyz.
  • Subtask 2 (30 points): 1≤n≤5000001\le n\le 500000; n=∣s∣n=|s|; the characters of ss belong to bcdfghjklmnpqrstvwxyz.
  • Subtask 3 (50 points): 1≤n≤5000001\le n\le 500000; n=∣s∣n=|s|; the characters of ss belong to abcdefghijklmnopqrstuvwxyz.

Example 1

Input

eleetminicoworoep

Output

13

Explanation

Positions 2 through 14 form leetminicowor, with two occurrences each of e, i, o and none of a or u. Every interval of length 14 or more has an odd vowel count.

Example 2

Input

leetcodeisgreat

Output

5

Explanation

The interval leetc contains two e characters. For each length from 6 through 15, the number of qualifying intervals is zero, so 5 is maximal.

Example 3

Input

bcbcbc

Output

6

Explanation

There are no vowels, so the whole six-character string qualifies.