Generate the **Look and Say** sequence.

`n`^{th}

element of the **Look and Say** sequence:

Starting with 1, the `n`

element of the sequence is generated by reading off the digits of the ^{th}`(n -1)`

element, counting the number of digits in groups of the same digit.^{th}

- 1 is read off as "one 1" or 11.
- 11 is read off as "two 1s" or 21.
- 21 is read off as "one 2, then one 1" or 1211.

**Example:**

Input : 5 Output : 111221

Need a **hand?** Try out these hints, one at a time.

public static String lookAndSay(int sequenceNumber) { if (sequenceNumber <= 0) return null; String output = "1"; int i = 1; while (i < sequenceNumber) { StringBuilder stringBuilder = new StringBuilder(); int count = 1; for (int j = 1; j < output.length(); j++) { if (output.charAt(j) == output.charAt(j - 1)) { count++; } else { stringBuilder.append(count); stringBuilder.append(output.charAt(j - 1)); count = 1; } } stringBuilder.append(count); stringBuilder.append(output.charAt(output.length() - 1)); output = stringBuilder.toString(); i++; } return output; }

**C**

**Java**

**Python**