Code gets compiled on eclipse ide but showing error in compiling online

Code gets compiled in eclipse ide but showing this error in online compiling and submitting
Main.java:27: error: cannot find symbol
if (s1.compareTo(s2) < 0) {
^
symbol: method compareTo(StringBuilder)
location: variable s1 of type StringBuilder
1 error
Here is my code:

Here is the working piece of code

Not able to find out why test cases are not passing

Your code doesn’t print spaces between the numbers please check it.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

not able to find out why test case are not passing here is my code https://ide.codingblocks.com/s/367750

@shubhamkumarsingh
You can close this doubt and ask another doubt for different doubt