Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.*;
- import java.util.regex.*;
- public class Solution {
- public static void main(String[] args) {
- /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
- Scanner in=new Scanner(System.in);
- int tc=in.nextInt();
- for(i=1;i<=tc;i++)
- {
- boolean ch=true;
- try{
- String st=in.nextLine();
- Pattern p=Pattern.compile(st);
- }
- catch(Exception E)
- {
- System.out.println("Invalid");
- ch=false;
- }
- if(ch==true)
- System.out.println("Valid");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement