implement reverse string with unit tests in Java, Python, Scala