Matej Focko
6c6b311a4b
URL: https://leetcode.com/problems/delete-characters-to-make-fancy-string/ Signed-off-by: Matej Focko <me@mfocko.xyz>
7 lines
260 B
Kotlin
7 lines
260 B
Kotlin
class Solution {
|
|
fun makeFancyString(s: String): String =
|
|
s.windowedSequence(3, partialWindows = true)
|
|
.filter { it.length < 3 || it[0] != it[1] || it[1] != it[2] }
|
|
.map { it[0] }
|
|
.joinToString(separator = "")
|
|
}
|