Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Problem_09_CombineListsOfLetters {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String firstText = scanner.nextLine();
- String secondText = scanner.nextLine();
- StringBuilder sb = new StringBuilder();
- sb.append(firstText+ " ");
- for (int i = 0; i < secondText.length(); i++) {
- for (int j = 0; j < firstText.length(); j++) {
- if (secondText.charAt(i) == firstText.charAt(j)) {
- break;
- }
- if (j == firstText.length()-1) {
- sb.append(secondText.charAt(i)+" ");
- }
- }
- }
- System.out.println(sb);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement