Advertisement
Sinux1

PS7Q2

Oct 20th, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 KB | None | 0 0
  1. import java.util.*;
  2. class Q2 {
  3.  
  4.     public static void main(String[] args)
  5.     {
  6.         Scanner kb = new Scanner(System.in);
  7.        
  8.         Set<String> chars = new TreeSet<String>();
  9.        
  10.         System.out.println("Enter 10 words");
  11.        
  12.        
  13.         for(int count = 0; count < 10; count++)
  14.         {
  15.             System.out.println("Enter word " + (count + 1));
  16.             chars.add(kb.next());
  17.         }
  18.        
  19.         System.out.println("Here is that data without duplicates:");;
  20.        
  21.         for(String letts : chars)
  22.         {
  23.             System.out.println(letts);
  24.            
  25.         }
  26.         kb.close();
  27.     }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement