#K94342. Battle Index
Battle Index
Battle Index
Given a string (S), the battle index is defined as the total number of distinct substrings of (S). A substring is any contiguous sequence of characters within (S). In other words, if (S) has length (n), then for every pair of indices (1 \le i \le j \le n), the substring (S[i:j]) is considered, and duplicates are counted only once. For example, if (S = \texttt{abc}), its distinct substrings are (\texttt{a}), (\texttt{b}), (\texttt{c}), (\texttt{ab}), (\texttt{bc}), and (\texttt{abc}), so the battle index is 6.
inputFormat
Input is given via standard input. The input consists of a single line containing the string (S). The string (S) is guaranteed to contain only English letters.
outputFormat
Output the battle index of the given string (S) to standard output. That is, output a single integer representing the number of distinct substrings in (S).## sample
abc
6