We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Hiring developers?
  1. Prepare
  2. Regex
  3. Applications
  4. Utopian Identification Number

Utopian Identification Number

Problem
Submissions
Leaderboard
Discussions

A new identification number is given for every Citizen of the Country Utopia and it has the following format.

  • The string must begin with between 0-3 (inclusive) lowercase letters.
  • Immediately following the letters, there must be a sequence of digits (0-9). The length of this segment must be between 2 and 8, both inclusive.
  • Immediately following the numbers, there must be atleast 3 uppercase letters.

Your task is to find out if a given identification number is valid or not.

Input Format

The first line contains N, N lines follow each line containing an identification number.

Constraints

1 <= N <= 100

Output Format

For every identification number, please print

VALID

if the identification number is valid and print

INVALID

otherwise.

Sample Input

2
abc012333ABCDEEEE
0123AB

Sample Output

VALID
INVALID

Explanation

The first testcase is valid as it starts with 3 letters, followed by 6 integers (max of 8 and min of 2) and ends with more than 3 uppercase letters.
The second testcase is invalid as it satisfies the first (at least 0 lowercase letters) and the second condition (alteast 2 integers) but fails on the third condition.

Viewing Submissions

You can view others' submissions if you solve this challenge. Navigate to the challenge leaderboard.

Author

dheeraj

Difficulty

Easy

Max Score

15

Submitted By

11276

Need Help?


View discussions
View top submissions

rate this challenge

MORE DETAILS

Download problem statement
Download sample test cases
Suggest Edits
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy