Advertisement
Guest User

Untitled

a guest
Sep 19th, 2014
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. import java.util.ArrayList;
  2. import java.util.HashSet;
  3. import java.util.LinkedHashSet;
  4. import java.util.Scanner;
  5. import java.util.Set;
  6.  
  7. public class CombineListsOfLetters {
  8.  
  9. public static void main(String[] args) {
  10. Scanner scn = new Scanner(System.in);
  11. String firstLine = scn.nextLine();
  12. String secondLine = scn.nextLine();
  13.  
  14. ArrayList<Character> input = new ArrayList<>();
  15. for (char c : firstLine.toCharArray()) {
  16. input.add(c);
  17. }
  18. for (char c : secondLine.toCharArray()) {
  19. input.add(c);
  20. }
  21.  
  22. Set<Character> s = new LinkedHashSet<Character>(input);
  23. for (Character character : s) {
  24. System.out.print(character);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement