Files

31 lines
781 B
Java
Raw Permalink Normal View History

2017-02-16 23:51:56 -06:00
// Author: Rodney Shaghoulian
2018-07-27 16:45:56 -07:00
// Github: github.com/RodneyShag
// HackerRank: hackerrank.com/RodneyShag
2017-02-16 23:51:56 -06:00
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
2017-04-05 18:42:35 -05:00
public static void main(String[] args) {
2017-02-16 23:51:56 -06:00
Scanner in = new Scanner(System.in);
int testCases = Integer.parseInt(in.nextLine());
2017-02-24 00:24:47 -06:00
while (testCases > 0) {
2017-02-16 23:51:56 -06:00
String username = in.nextLine();
String pattern = "^[a-zA-Z]\\w{7,29}$";
Pattern r = Pattern.compile(pattern);
Matcher m = r.matcher(username);
2017-02-24 00:24:47 -06:00
if (m.find()) {
2017-02-16 23:51:56 -06:00
System.out.println("Valid");
} else {
System.out.println("Invalid");
}
testCases--;
}
}
}