ribbon logo
ribbon contest type Free Academy Experience

Preparing for tech interviews?
Learn from the best instructors in the field.

Try Academy for FREE!


Validating Phone Numbers

Problem Description

We had learnt about RegEx. Now, let's try some interesting problem.
You are given some input, and you are required to check whether they are valid mobile numbers.

A valid mobile number is a ten digit number starting with a 6, 7, 8 or 9.

Problem Constraints

1 <= N <= 1000

1 <= length of string <= 100

Input Format

The first line contains an integer N, the number of inputs.

N lines follow, each containing some string.

Output Format

For every string listed, print "YES" if it is a valid mobile number and "NO" if it is not on separate lines. Do not print the quotes.

Example Input

3
6431923912
93214#2124
2987321452

Example Output

YES
NO
NO
Start solving Validating Phone Numbers on Interview Code Editor
Hints
  • Complete Solution

Discussion


Loading...
Click here to start solving coding interview questions