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. Valid PAN format

Valid PAN format

Problem
Submissions
Leaderboard
Discussions

The equivalent of SSN in India is a PAN number, which is unique to each of its citizens. In any of the country's official documents, the PAN number is listed as follows

<char><char><char><char><char><digit><digit><digit><digit><char>

Your task is to figure out if the PAN number is valid or not. A valid PAN number will have all its letters in uppercase and digits in the same order as listed above.

Input Format

First line contains . lines follow, each having a PAN number.

Constraints

  • Each char is an uppercase letter, i.e., .
  • Each digit lies between 0 and 9, i.e., .
  • The length of the PAN number is always 10, i.e.,
  • Every character in PAN is either char or digit satisfying the above constraints.

Output Format

For every PAN number listed, print YES if it is valid and NO if it isn't.

Sample Input

3
ABCDS1234Y
ABAB12345Y
avCDS1234Y

Sample Output

YES
NO
NO

The first PAN number is valid since the first 5 characters are letters, the next 4 are digits and the last character is an alphabet. All letters in input is in uppercase.
The second PAN number is invalid as the fifth character is a digit as opposed to an letter.
The third PAN number contains lowercase characters. Hence invalid

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

17734

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