#C6759. Unique Substrings Check
Unique Substrings Check
Unique Substrings Check
Given a string S
, determine whether all of its possible substrings are unique. A substring is defined as a contiguous sequence of characters within the string, and for a string of length n, there are \(\frac{n(n+1)}{2}\) possible substrings (including the string itself and single characters).
The answer should be Unique
if no substring appears more than once, and Not Unique
otherwise. Note that an empty string is considered to have all unique substrings.
Example:
- Input: "abcd" → Output: Unique
- Input: "aa" → Output: Not Unique
inputFormat
The input consists of a single line containing the string S
. The string may include letters, digits, and special characters.
outputFormat
Output a single line: Unique
if all substrings of the input string are unique, otherwise Not Unique
.
abcd
Unique