public List<String> decode(String s) {
            if (s == null) return null;
            List<String> strs = new ArrayList<String>();
            if (s.isEmpty()) return strs;

            int i = 0;
            while (i < s.length()) {
                int j = i + 1;
                while (s.charAt(j) != '$') ++j;
                int len = Integer.parseInt(s.substring(i, j));
                strs.add(s.substring(j + 1, j + 1 + len));
                i = j + 1 + len;
            }
            return strs;
        }