mirror of
https://github.com/mx42/adventofcode.git
synced 2026-01-14 22:09:50 +01:00
17 lines
296 B
Scala
17 lines
296 B
Scala
import scala.io.StdIn._
|
|
|
|
|
|
val items = Iterator
|
|
.continually(readLine)
|
|
.takeWhile(_ != null)
|
|
.toList
|
|
|
|
val res = items
|
|
.combinations(2)
|
|
.map(x => x(0) zip x(1))
|
|
.dropWhile(_.count(t => t._1 != t._2) != 1)
|
|
.map(_.filter(t => t._1 == t._2).map(_._1))
|
|
.next
|
|
|
|
println(res.mkString(""))
|