Word search solver in Kotlin