Refactored all solutions
This commit is contained in:
@@ -6,14 +6,12 @@ import java.util.Scanner;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
|
||||
/* If a PatternSyntaxException is not thrown by Pattern.compile,
|
||||
then the regular expression is valid.
|
||||
*/
|
||||
// If a PatternSyntaxException is not thrown by Pattern.compile, the regular expresion is valid
|
||||
public class Solution {
|
||||
public static void main(String[] args){
|
||||
public static void main(String[] args) {
|
||||
Scanner scan = new Scanner(System.in);
|
||||
int testCases = Integer.parseInt(scan.nextLine());
|
||||
while (testCases-- > 0){
|
||||
while (testCases-- > 0) {
|
||||
String pattern = scan.nextLine();
|
||||
try {
|
||||
Pattern.compile(pattern);
|
||||
|
||||
Reference in New Issue
Block a user