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.
What is wrong with the code below? It failed all test cases
publicstaticvoidmain(String[]args){Scannersc=newScanner(System.in);StringA=sc.next();StringB=sc.next();/* Enter your code here. Print output to STDOUT. */System.out.println(A.length()+B.length());char[]CA=A.toCharArray();char[]CB=B.toCharArray();intcompareLength=(A.length()<B.length())?A.length():B.length();booleanisABigger=false;for(inti=0;i<compareLength;i++){if(CA[i]>CB[i]){isABigger=true;break;}}if(isABigger){System.out.println("Yes");}else{System.out.println("No");}}
Java Strings Introduction
You are viewing a single comment's thread. Return to all comments →
What is wrong with the code below? It failed all test cases