Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- import java.util.Scanner;
- public class CombineListsOfLetters {
- public static void main(String[] args){
- Scanner input = new Scanner(System.in);
- String input_one = input.nextLine();
- String input_two = input.nextLine();
- char[] chars_one = input_one.toCharArray();
- char[] chars_two = input_two.toCharArray();
- ArrayList<Character> result = new ArrayList<Character>();
- ArrayList<Character> check = new ArrayList<Character>();
- for (Character character : chars_one) {
- result.add(character);
- check.add(character);
- }
- for (int j = 0; j < chars_two.length; j++) {
- if (!check.contains(chars_two[j])) {
- result.add(' ');
- result.add(chars_two[j]);
- }
- }
- for (Character character : result) {
- System.out.print(character);
- }
- input.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement