String Compression

00:00
EasyStringTwo PointersIn-place
AccentureWipro

Compress character array in-place using run-length encoding. Write char followed by count (omit count if 1). Return new length.

Examples

Input → ['a','a','b','b','c','c','c']
Output → 6, ['a','2','b','2','c','3']
Input → ['a']
Output → 1
Input → ['a','b','b','b','b','b','b','b','b','b','b','b','b']
Output → 4, ['a','b','1','2']