In this HackerRank Java Strings Introduction problem, you have given two lowercase English letters, and we need to sum the lengths of both strings. and also need to determine if the first string is larger than the second string. and we also need to capitalize the first letter of both strings and print them on a single line.

HackerRank Java Strings Introduction problem solution

HackerRank Java Strings Introduction problem solution

import java.util.*;
    
public class Solution {

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String A = sc.next();
        String B = sc.next();
        sc.close();
        
        System.out.println( A.length() + B.length() );
        System.out.println( (A.compareTo(B) > 0) ? "Yes" : "No");
        System.out.println(
            A.substring(0, 1).toUpperCase() + A.substring(1) + " " +
            B.substring(0, 1).toUpperCase() + B.substring(1)
        );
    }
}