-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringsIntroduction.java
More file actions
28 lines (22 loc) · 962 Bytes
/
StringsIntroduction.java
File metadata and controls
28 lines (22 loc) · 962 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
import java.io.*;
import java.util.*;
/*
Input Format:
The first line contains a string A. The second line contains another string B.
The strings are comprised of only lowercase English letters.
Output Format:
There are three lines of output:
For the first line, sum the lengths of A and B.
For the second line, write Yes if A is lexicographically larger than B or No if it is not.
For the third line, capitalize the first letter in both A and B and print them on a single line, separated by a space.
*/
public class StringsIntroduction {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
String A=sc.next();
String B=sc.next();
System.out.println(A.length()+B.length());
System.out.println(A.compareTo(B)>0?"Yes":"No");
System.out.println(Character.toUpperCase(A.charAt(0)) + A.substring(1)+" "+Character.toUpperCase(B.charAt(0)) + B.substring(1));
}
}