#C12381. Counting Unique Substrings

    ID: 41802 Type: Default 1000ms 256MiB

Counting Unique Substrings

Counting Unique Substrings

Given a string s, your task is to determine the number of unique substrings present in s. A substring is defined as a contiguous sequence of characters within the string. Note that even if there are multiple occurrences of a substring, it should be counted only once.

For example, if s has a length of n, the total number of substrings (including duplicates) is given by \(\frac{n(n+1)}{2}\). However, here you only need to count the distinct substrings.

inputFormat

The input consists of a single line containing the string s.

outputFormat

Output a single integer representing the number of unique substrings in the input string.

## sample
ababc
12