Skip to content

Commit 857058e

Browse files
authored
Update RegexMatcher.java
added main
1 parent e6f4a5c commit 857058e

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/main/java/com/thealgorithms/Recursion/RegexMatcher.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import java.util.HashMap;
22
import java.util.Map;
3+
import java.util.Scanner;
34

45
public class Solution {
56
// Memoization map to store results of subproblems
@@ -33,4 +34,26 @@ public boolean isMatch(String s, String p) {
3334
memo.put(key, result);
3435
return result;
3536
}
37+
38+
public static void main(String[] args) {
39+
Solution solution = new Solution();
40+
Scanner scanner = new Scanner(System.in);
41+
42+
System.out.print("Enter the input string: ");
43+
String inputString = scanner.nextLine();
44+
45+
System.out.print("Enter the pattern: ");
46+
String pattern = scanner.nextLine();
47+
48+
boolean isMatch = solution.isMatch(inputString, pattern);
49+
50+
if (isMatch) {
51+
System.out.println("The string matches the pattern.");
52+
} else {
53+
System.out.println("The string does not match the pattern.");
54+
}
55+
56+
scanner.close();
57+
}
3658
}
59+

0 commit comments

Comments
 (0)