#C6066. Valid Gem Sequence

    ID: 49785 Type: Default 1000ms 256MiB

Valid Gem Sequence

Valid Gem Sequence

You are given a sequence of collected gems represented as a string consisting of digits. The sequence is considered valid if each gem (digit) appears in one continuous block and does not reappear later in the sequence.

For example, the sequence "1122334" is valid because each digit appears in a contiguous group. However, the sequence "123124" is invalid because the digit '1' appears, then other digits intervene, and '1' appears again. Mathematically, if we let \(s\) be the sequence, then for every digit \(d\), the indices at which \(d\) appears must form a contiguous segment.

Your task is to determine whether the given gem sequence is valid.

inputFormat

The input consists of a single line containing the gem sequence as a string. There are no spaces or additional characters.

outputFormat

Output a single line: print "VALID" if the sequence is valid, and "INVALID" if it is not.

## sample
1122334
VALID