Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Hahaha definitely :]
To be honest I often do not focus on producing the cleanest solution while doing Katas and I was a bit surprised about the harsh remark by the other commenter!
So thanks for chiming in.
I love this. It's easy to understand and makes great use of lots of Kotlin's handy helper methods. I had no idea that substringAfter existed, along with the singleOrNull method. That's what I get for just starting with the language!
I would avoid hardcoding what a valid town can be. While that might work on the test cases presented here, it would only take an additional test or two to cause this code to break. Instead, I would rely on the data given to you, and figure out a way to parse that to determine what a valid town is. That allows your code to be much more flexible in what it can handle.
I think that "unreadable crap" is a bit harsh, but this seems a little more in the realm of a code golfing solution. While it does get the job done, if you were to come back to this a few weeks later, I think you'd be a little mad at past you for unnecessarily obfuscating your code.