File tree 1 file changed +23
-0
lines changed
src/main/java/com/thealgorithms/Recursion 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 1
1
import java .util .HashMap ;
2
2
import java .util .Map ;
3
+ import java .util .Scanner ;
3
4
4
5
public class Solution {
5
6
// Memoization map to store results of subproblems
@@ -33,4 +34,26 @@ public boolean isMatch(String s, String p) {
33
34
memo .put (key , result );
34
35
return result ;
35
36
}
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
+ }
36
58
}
59
+
You can’t perform that action at this time.
0 commit comments