cswork / OA打开练习工作台

DeloitteOA #6

Longest Substring with Even Occurrences

估计中等可在线判题

考点(AI 标注)前缀和区间位运算哈希计数

Find the longest contiguous substring in which every English letter occurs an even number of times; if no non-empty substring exists, output 0.

This site's standard input/output format and any supplementary ranges follow this problem's description.

输入格式

One line containing a string of only lowercase English letters, 1≤|S|≤100000.

输出格式

Output the longest length.

样例 1

输入:

bdaaadadb

输出:

6

样例 2

输入:

abacb

输出:

0

样例 3

输入:

zthtzh

输出:

6