#K59762. Minimum Unique Substring Splitting

    ID: 30937 Type: Default 1000ms 256MiB

Minimum Unique Substring Splitting

Minimum Unique Substring Splitting

Given a string s, partition it into the minimum number of substrings such that each substring contains only unique characters - no character repeats within a substring. When a repeated character is encountered, a new substring must be started. The goal is to minimize the total number of substrings in the partition.

For example, if s = "abac", the optimal splitting is [ab, ac] which results in 2 substrings.

In mathematical terms, for a string s that can be decomposed as
\(s = s_1 s_2 \ldots s_k\)
where each substring \(s_i\) is comprised of unique characters, determine the minimum value of \(k\).

inputFormat

The input consists of a single line containing a string s. The string may be empty and consists of lowercase English letters.

outputFormat

Output a single integer representing the minimum number of substrings required such that each substring's characters are all unique. The result should be printed to stdout.

## sample
abac
2