public String longestPalindrome(String s) {
        if (s.length() == 0)
            return "";
        String result = "";
        int max = -1;
        for (int i = 0; i < s.length(); ++i) {
            String temp = getString(s, i, i);
            if (temp.length() > max) {
                max = temp.length();
                result = temp;
            }
            temp = getString(s, i, i + 1);
            if (temp.length() > max) {
                max = temp.length();
                result = temp;
            }
        }
        return result;
    }