개요[ | ]
- HR자바 Pattern Syntax Checker
Java
Copy
import java.util.Scanner;
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 pattern = in.nextLine();
//Write your code
try {
Pattern.compile(pattern);
System.out.println("Valid");
}
catch (PatternSyntaxException exception) {
System.out.println("Invalid");
}
}
}
}
편집자 Jmnote Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.