-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExecute.java
More file actions
46 lines (36 loc) · 1.21 KB
/
Execute.java
File metadata and controls
46 lines (36 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package Algorithms;
import java.util.*;
import java.lang.*;
public class Execute
{
public static void main(String args[])
{
Naive obj1 =new Naive();
Rabin_karp obj2=new Rabin_karp();
KMP obj3=new KMP();
BMA obj4=new BMA();
Scanner sc=new Scanner(System.in);
System.out.println("Enter the string: ");
String givenstr=sc.next();
System.out.println("Enter the Pattern to be matched: ");
String pattern = sc.next();
while(true) {
System.out.println("CHOOSE A STRING MATCHING ALGORITHM: /n1.Naive /n2.Rabin Karp /n3.Knuth Moris Patt /n4.Boyer Moore /n5.Exit ");
int choice=sc.nextInt();
switch(choice)
{
case 1: obj1.Naivesearch(pattern, givenstr);
break;
case 2: int q=101;
obj2.RKsearch(pattern,givenstr,q);
break;
case 3:obj3.KMPmatcher(givenstr,pattern);
break;
case 4:obj4.BoyerMoore(givenstr,pattern);
break;
case 5: System.exit(0);
default:System.out.println("Invalid Input");
}
}
}
}