fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. Set<String> words = new HashSet<String>();
  13. Scanner in = new Scanner(System.in);
  14. while(in.hasNext())
  15. {
  16. String word = in.next();
  17. words.add(word);
  18. System.out.println(word);
  19. }
  20. System.out.println("Done");
  21. }
  22. }
Success #stdin #stdout 0.11s 380672KB
stdin
word1
word2 word3
word4
stdout
word1
word2
word3
word4
Done