Guest User

CombineLetters

a guest
May 24th, 2014
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.55 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class _09_CombineListsOfLetters {
  4.  
  5.     public static void main(String[] args) {
  6.  
  7.         Scanner sc = new Scanner(System.in);
  8.         String listOfLetts1 = sc.nextLine();
  9.         String listOfLetts2 = sc.nextLine();
  10.         StringBuilder listsCombined = new StringBuilder(listOfLetts1);
  11.  
  12.         String[] letters2 = listOfLetts2.split(" ");
  13.  
  14.         for (int i = 0; i < letters2.length; i++) {
  15.             if (listOfLetts1.contains(letters2[i])) {
  16.  
  17.             } else {
  18.                 listsCombined.append(" " + letters2[i]);
  19.             }
  20.         }
  21.         System.out.println(listsCombined);
  22.     }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment