#C9035. Anagram Substrings Checker

    ID: 53084 Type: Default 1000ms 256MiB

Anagram Substrings Checker

Anagram Substrings Checker

Given a string s, determine whether there exist two distinct substrings of s that are anagrams of each other. A substring is defined as a contiguous sequence of characters from s.

If at least one pair of substrings (of equal length) exist that are anagrams (i.e. they consist of the same multiset of characters), output True; otherwise, output False. In addition, if the input is not a valid string (in this problem, if the entire input consists solely of digits), the output should be Not valid. The empty string is considered valid and should yield False.

Note: Two substrings are considered anagrams if, after arranging their characters in sorted order (i.e., using the LaTeX formatted sort key \( \text{sorted}(substring) \)), they are identical.

inputFormat

The input consists of a single line containing the string s. This string is read from the standard input (stdin).

outputFormat

Output a single line to the standard output (stdout) containing True if there exists at least one pair of substrings that are anagrams of each other, False otherwise. If the input is not valid (i.e., it consists only of digits), output Not valid.

## sample
abc
False

</p>