#C10695. Count Distinct Substrings

    ID: 39928 Type: Default 1000ms 256MiB

Count Distinct Substrings

Count Distinct Substrings

Given a string s, your task is to determine the number of distinct substrings contained in s. A substring is defined as any contiguous sequence of characters from s. For example, the string "abc" has 6 distinct substrings.

Note that the input will be provided via standard input (stdin) as a single line string, and your program should output the result to standard output (stdout).

Example:

  • Input: "abc"
  • Output: 6

inputFormat

The input consists of a single line containing the string s. The string may be empty or contain any characters.

outputFormat

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

## sample
abc
6