cswork / OA打开练习工作台

AmazonOA #236

Minimal Unique Segments

估计中等可在线判题

考点(AI 标注)贪心调度哈希计数字符串

Cut a lowercase string into non-empty contiguous segments so that no character appears more than once within a segment; find the minimum number of segments. Characters cannot be reordered or skipped.

输入格式

One line containing the string. 1≤length≤100000, lowercase letters only.

输出格式

Output a single integer, the answer.

样例 1

输入:

abac

输出:

2

样例 2

输入:

aaaa

输出:

4

样例 3

输入:

abcabc

输出:

2

样例说明

The answers are 2, 4 and 2; abcabc can be split into abc and abc.