2
public String countSay(int n, String[] mapper) {3
if (n == 1) return mapper[1];6
if (mapper[n - 1] != null) say += mapper[n - 1];7
else say += countSay(n - 1, mapper);9
int cache = Integer.parseInt(say.substring(0, 1));11
if (say.length() < 2) {12
count += "1" + Integer.toString(cache);14
for (int i = 1; i < say.length(); i++) {15
if (cache == Integer.parseInt(say.substring(i, i + 1))) {17
if (i == say.length() - 1) {18
count += Integer.toString(cntr) + Integer.toString(cache);22
count += Integer.toString(cntr) + Integer.toString(cache);23
if (i < say.length() - 1) {24
cache = Integer.parseInt(say.substring(i, i + 1));26
} else if (i == say.length() - 1) {27
count += "1" + say.substring(i, i + 1);37
public String countAndSay(int n) {38
String mapper[] = new String[n + 1];40
return countSay(n, mapper);