We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
importjava.util.Scanner;publicclassHackerRank_Java_Strings_Introduction{publicstaticvoidmain(String[]args){Scannerscn=newScanner(System.in);StringA=scn.next();StringB=scn.next();StringupCaseA,upCaseB;intcounterA,counterB;// Added the first latter upperCase to the string variableupCaseA=A.substring(0,1).toUpperCase()+A.substring(1).toLowerCase();upCaseB=B.substring(0,1).toUpperCase()+B.substring(1).toLowerCase();// Added characters are collectedcounterA=A.length();counterB=B.length();// Collected characters are printedSystem.out.println(counterA+counterB);if(A.compareTo(B)>0){System.out.println("Yes");}else{System.out.println("No");}// Print the entered wordsSystem.out.println(upCaseA+" "+upCaseB);}}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java Strings Introduction
You are viewing a single comment's thread. Return to all comments →