Merging Two Strings

 import java.util.Scanner;

class SolutionLe{

public static void main(String arg[]){

Scanner sc=new Scanner(System.in);

String word1=sc.next();

String word2=sc.next();

int i=0,j=0;

String s="";

while(i<word1.length() && j<word2.length()){

s=s+word1.charAt(i++);

s=s+word2.charAt(j++);

}

while(i<word1.length()){

s=s+word1.charAt(i++);

}

while(j<word2.length())

{

s=s+word2.charAt(j++);

}

System.out.println(s);

}

}

Comments

Popular posts from this blog

Solutions Of Practice Questions Dated 01-06-2022

CODEFORCES SPY DETECTED ROUND 713

Maximum Winning Score Geeks For Geeks