Essa empresa é sua?
String compression and decompression. "aaabbb222" to "a3b323" (compress), then decompress back to original string. The trick would be when a character has more than 10 digits, better format your output compressed string in order to easily decompress it.
Sigiloso
//In scala def compress(str: String, c: Char, count: Int = 1, accum: String = ""): String = { if(str.isEmpty) accum + s"$c$count" else if(str.head == c) compress(str.tail, c, count + 1, accum) else compress(str.tail, str.head, accum = accum + s"$c$count") }