loops of any kind, lists, or is not allowed. At the Academy of Crime Fighting, each trainee is recognized by a unique 5-digit identifier. The identifier can have any of the following digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. The identifier can have leading 0s. Since Drew the owl has trouble typing numbers, the school makes things easier by ensuring that each successive digit in the identifier

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter7: Characters, Strings, And The Stringbuilder
Section: Chapter Questions
Problem 4GZ
icon
Related questions
Question

Python Language]

Using loops of any kind, lists, or is not allowed.

At the Academy of Crime Fighting, each trainee is recognized by a unique 5-digit identifier. The identifier can have any of the following digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. The identifier can have leading 0s.

Since Drew the owl has trouble typing numbers, the school makes things easier by ensuring that each successive digit in the identifier is either one digit greater or one digit less than the previous digit. For example, if the first digit is 3, then the successive digit would be 4 or 2. So, 32345 would be a valid trainee identifier, but 32435 would NOT be a valid identifier because the third digit 4 is two digits away from the previous digit 2.

Your task is to write a program that validates an identifier.

Input

The input consists of five lines; the first line is the first digit of the trainee identifier, the second line is the second digit of the trainee identifier, and so on.

Output

If the trainee identifier is valid, print VALID. Otherwise, print INVALID.

Sample Input 1

5 4 3 4 5

Sample Output 1

VALID

Sample Input 2

5 6 7 5 6

Sample Output 2

INVALID

Sample Input 3

1 2 3 4 9

Sample Output 3

INVALID

Expert Solution
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Adjacency Matrix
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT