-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathYT27.java
More file actions
40 lines (30 loc) · 914 Bytes
/
YT27.java
File metadata and controls
40 lines (30 loc) · 914 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
38
39
40
import java.io.*;
public class YT27
{
public static void main(String[] args)throws IOException
{
String s1, s2;
String rslt="";
char ch1, ch2;
InputStreamReader I = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(I);
System.out.println("Enter the 1st word: ");
s1=br.readLine().toUpperCase();
System.out.println("Enter the 2nd word: ");
s2=br.readLine().toUpperCase();
if(s1.length()!=s2.length())
{
System.out.println("Invalid Result");
}
else
{
for(int i=0; i<s1.length(); i++)
{
ch1=s1.charAt(i);
ch2=s2.charAt(i);
rslt=rslt+ch1+ch2;
}
System.out.println("New String: "+rslt);
}
}
}