Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Progmasters {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String string1 = scanner.nextLine();
- String string2 = scanner.nextLine();
- if (string1.length()>string2.length()) {
- String newString = "";
- int i = 0;
- while (i<string2.length()){
- newString =string2.substring(i, i+1)+string1.substring(i, i+1);
- System.out.print(newString);
- i++;
- }
- System.out.print(string1.substring(i));
- }
- else {
- String newString = "";
- int i = 0;
- while (i<string1.length()){
- newString = string2.substring(i, i+1)+string1.substring(i, i+1);
- System.out.print(newString);
- i++;
- }
- System.out.print(string2.substring(i));
- }
- scanner.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement