online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
/****************************************************************************** Online Java Compiler. Code, Compile, Run and Debug java program online. Write your code in this editor and press "Run" button to execute it. *******************************************************************************/ public class Main { public static void main(String[] args) { String str="welcometojava"; int k=3; String smallest=str.substring(0,k); String largest=str.substring(0,k); Solution(smallest,k,largest,str); } static void Solution(String smallest,int k, String largest, String str) { String sub; for(int i=1;i<=str.length()-k;i++){ sub=str.substring(i,i+k); if(sub.compareTo(smallest)<0){ smallest=str.substring(i,i+k); } if(sub.compareTo(largest)>0){ largest=str.substring(i,i+k); } } System.out.println(smallest+" "+ largest); } }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue