31 lines
781 B
Java
31 lines
781 B
Java
// Author: Rodney Shaghoulian
|
|
// Github: github.com/RodneyShag
|
|
// HackerRank: hackerrank.com/RodneyShag
|
|
|
|
import java.io.*;
|
|
import java.util.*;
|
|
import java.text.*;
|
|
import java.math.*;
|
|
import java.util.regex.*;
|
|
|
|
public class Solution {
|
|
public static void main(String[] args) {
|
|
Scanner in = new Scanner(System.in);
|
|
int testCases = Integer.parseInt(in.nextLine());
|
|
while (testCases > 0) {
|
|
String username = in.nextLine();
|
|
String pattern = "^[a-zA-Z]\\w{7,29}$";
|
|
|
|
Pattern r = Pattern.compile(pattern);
|
|
Matcher m = r.matcher(username);
|
|
|
|
if (m.find()) {
|
|
System.out.println("Valid");
|
|
} else {
|
|
System.out.println("Invalid");
|
|
}
|
|
testCases--;
|
|
}
|
|
}
|
|
}
|