public static void main(String[] args) throws Exception{
        String dictFile = "words.txt";
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String line;
        TopQueue topQueue;
        long startTime;
        long consumingTime;

        if(args.length == 1) {
            dictFile = args[0];
        }
        else if(args.length == 0) {
            System.out.println("The system will using the default setting.");
            System.out.println("java N_Gram words.txt");
        }
        else {
            System.out.println("usage: java N_Gram [dictionary]");
            return;
        }

        while((line = reader.readLine()) != null){
            System.out.println("2-gram search:");
            startTime = System.currentTimeMillis();
            topQueue = search(line, dictFile);
            topQueue.print();
            consumingTime = System.currentTimeMillis() - startTime;
            System.out.println(consumingTime + " ms");
        }
    }