#C6002. Unique Substrings

    ID: 49715 Type: Default 1000ms 256MiB

Unique Substrings

Unique Substrings

Given a string \(S\), your task is to compute the number of unique substrings contained in \(S\). A substring is defined as any contiguous sequence of characters extracted from \(S\). For instance, if \(S = "abc"\), its unique substrings are: \(a, b, c, ab, bc, abc\) – hence, the answer is 6.

Note: If the string contains repeated characters, some substrings may be identical. Be sure to count each distinct substring only once.

inputFormat

The input consists of a single line containing the string \(S\). The string will contain only lowercase English letters.

outputFormat

Output a single integer denoting the number of unique substrings of \(S\).

## sample
abc
6

</p>