-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBigger.java
More file actions
37 lines (35 loc) · 1015 Bytes
/
Bigger.java
File metadata and controls
37 lines (35 loc) · 1015 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import java.util.Scanner;
public class Bigger {
String a;
String b;
Bigger(){
Scanner s = new Scanner(System.in);
a= s.next();
b=s.next();
}
public static void main(String[] args) {
Bigger obj = new Bigger();
int ls1 = obj.a.length();
int ls2 = obj.b.length();
String s="";
if(ls1<=ls2){
for(int j=0;j<ls1;j++){
s+= Character.toString(obj.a.charAt(j));
s+= Character.toString(obj.b.charAt(j));
}
for(int i=ls1;i<ls2;i++ ){
s+= Character.toString(obj.b.charAt(i));
}
}
else {
for(int j=0;j<ls2;j++){
s+= Character.toString(obj.a.charAt(j));
s+= Character.toString(obj.b.charAt(j));
}
for(int i=ls2;i<ls1;i++ ){
s+= Character.toString(obj.a.charAt(i));
}
}
System.out.println(s);
}
}