#C14609. Count Unique Substrings

    ID: 44277 Type: Default 1000ms 256MiB

Count Unique Substrings

Count Unique Substrings

Given a string (s), your task is to compute the number of unique substrings of (s). A substring is defined as any contiguous sequence of characters within (s). The substrings are case-sensitive, meaning that uppercase and lowercase letters are considered different. For example, in the string "abcabc", there are 15 unique substrings. Note that a substring is not necessarily unique by its position; if the same sequence appears more than once, it is counted only once.

inputFormat

Input is given from standard input (stdin) as a single line containing the string (s). The string can contain letters and other characters. The length of (s) is at most 1000.

outputFormat

Output the number of unique substrings of (s) to standard output (stdout).## sample

abcabc
15