document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1.  
  2. /**
  3.  * Get the input from the user
  4.  *
  5.  * @author (prabu)
  6.  * @version (2020/11/9)
  7.  */
  8. import java.util.*;
  9.  
  10. public class InputReader
  11. {
  12.     private Scanner reader;
  13.    
  14.     public InputReader()
  15.     {
  16.         reader = new Scanner(System.in);
  17.     }
  18.    
  19.     /**
  20.      * Read an integer input of option in the menu from the user input
  21.      */
  22.     public String getOptionInput()
  23.     {
  24.         System.out.print(">");
  25.         String option = reader.nextLine().trim().toLowerCase();
  26.         return option;
  27.     }
  28.    
  29.     /**
  30.      * Read a line of text from standart input (text terminal), and return it
  31.      * as a set of words.
  32.      *
  33.      * @return  A set of Strings, where each String is one of the words typed
  34.      *          by the user
  35.      */
  36.     public HashSet<String> getInput()
  37.     {
  38.         System.out.print(">"); // print prompt
  39.         String inputLine = reader.nextLine().trim().toLowerCase();
  40.         String[] wordArray = inputLine.split(" ");
  41.        
  42.         // add words from array into hashset
  43.         HashSet<String> words = new HashSet<String>();
  44.         for(String word: wordArray)
  45.         {
  46.             words.add(word);
  47.         }
  48.         return words;
  49.     }
  50. }
  51.  
');