public String countAndSay_v2(int n) {
        String ans = "1";
        for (int i = 1; i < n; ++i) {
            String temp = "";
            for (int j = 0; j < ans.length(); ++j) {
                int count = 1;
                while (j + 1 < ans.length() && ans.charAt(j) == ans.charAt(j + 1)) {
                    ++j;
                    count += 1;
                }
                temp += Integer.toString(count) + ans.charAt(j);
            }
            ans = temp;
        }
        return ans;
    }