#P2408. Count Distinct Substrings

    ID: 15679 Type: Default 1000ms 256MiB

Count Distinct Substrings

Count Distinct Substrings

Given a string of length \(n\), count the number of distinct substrings.

Two substrings are considered different if and only if they have different lengths or, if they are of the same length, there is at least one position at which they differ.

A substring is defined as a contiguous segment of the original string.

inputFormat

The input consists of a single line containing the string.

outputFormat

Output a single integer representing the number of distinct substrings of the given string.

sample

abc
6