public static void main(String[] args) { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); try { alphabet = reader.readLine(); firstRegExString = reader.readLine(); secondRegExString = reader.readLine(); length = Integer.parseInt(reader.readLine()); } catch (IOException e) { e .printStackTrace(); // To change body of catch statement use File | Settings | File // Templates. } firstRegex = new Regex(firstRegExString, alphabet); secondRegex = new Regex(Regex.encapsulate(secondRegExString), alphabet); // System.out.println(firstRegex.regex); // System.out.println(secondRegex.regex); machine1 = new StateMachine(alphabet); machine2 = new StateMachine(alphabet); machine1.DFA = machine1.convertNFAtoDFA(machine1.createTheNondeterministicFiniteAutomat(firstRegex)); machine2.DFA = machine2.convertNFAtoDFA(machine2.createTheNondeterministicFiniteAutomat(secondRegex)); // System.out.println(machine1.getIntersection(machine2)); LinkedList<State> intersection = machine1.getIntersection(machine2); WordCounter wc = new WordCounter(length); LinkedList<State> start = new LinkedList<State>(); // start.add(machine1.intersectfirststate); System.out.println(machine1.inteesectEnds.size()); // wc.getWordCount(start, 0); // System.out.println(wc.wordCount); getWordCount(); }