Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package year_2023.day_1
- fun partOne() {
- println("[2023] Day one, part one...")
- val numbers = input().split("\n")
- .map {
- val first = it.first { it.isDigit() }
- val last = it.last { it.isDigit() }
- "$first$last".toInt()
- }
- val sum = numbers.sum()
- println(sum)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement