/*design a parser that parse the given string and counts the number of characters that match the given data..using stack or queue ..*/
ex.
Given String : ABCDEFG
INPUT STRING : ACCDEFC
NO OF SAME STRING MATCHES IS : 5
na ka come up in this idea pero wrong iyang flow sa program ug logic ug concept to come up sa right solution
import java.util.*;
public class StackDemo{
public static Scanner console = new Scanner(System.in);
public static void main(String[] args) {
String item;
System.out.print("Enter a String:");
item = console.next();
int S[]=new int[10];
for(int i=0;i<item.length();i++)
{
Stack stack=new Stack();
stack.push("A");
stack.push("B");
stack.push(new String(item));
System.out.print(stack);
if(stack.size()==0){
System.out.println("stack is empty");
}else{
System.out.println("No.of matches" + stack.size() + "items");
}
}
}
}
What do u think guys asa ko na sayop then unsa sad dungag-gan