Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- class Q2 {
- public static void main(String[] args)
- {
- Scanner kb = new Scanner(System.in);
- Set<String> chars = new TreeSet<String>();
- System.out.println("Enter 10 words");
- for(int count = 0; count < 10; count++)
- {
- System.out.println("Enter word " + (count + 1));
- chars.add(kb.next());
- }
- System.out.println("Here is that data without duplicates:");;
- for(String letts : chars)
- {
- System.out.println(letts);
- }
- kb.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement