'CoderByte says all of my testcases are wrong?

I tried coderbyte and looks something is wrong with it. The first challenge is simply to reverse a string. I did this in java:

import java.util.*; 
import java.io.*;

class Main {

  public static String FirstReverse(String str) {
    char[] chars = str.toCharArray();
    String ret = "";
    for (int i = chars.length - 1; i >= 0; i--) {
      ret += chars[i];
    }
    return ret;
  }

  public static void main (String[] args) {  
    // keep this function call here     
    Scanner s = new Scanner(System.in);
    System.out.print(FirstReverse(s.nextLine())); 
  }

}

It said, that three test cases had wrong output and there was the correct output. I tried running the code with the specified cases and it printed the same string as correct output for that case. So I tried resubmitting it and it said that only one test case was correct and all other had wrong out put. So I said OK and rewrote my code this way:

import java.util.*; 
import java.io.*;

class Main {

  public static String FirstReverse(String str) {
    return new StringBuilder(str).reverse().toString();
  }

  public static void main (String[] args) {  
    // keep this function call here     
    Scanner s = new Scanner(System.in);
    System.out.print(FirstReverse(s.nextLine())); 
  }

}

Unfortunately it still says only one test case was successful... Any ideas what happened? Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source