What is you used s.isEmpty() instead of the first condition"(s.length() == 0)" will it be he same?