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.
Couldn't it happen that the year was 0001?
That's the thing, this kata only tests 4 digits years.
This solutions is slightly incorrect for it's not working for every given year.
Let's say we have a year (Just an assumption) 11100.
It will return a proper age but wrong suffix.
Your algorithm is not following a rule where every number with tens digit number has to be suffixed with 'th'.
Even tho, I think it's a very clever idea and it needs just a bit of polishing.
Btw. I know that my example is quite strange but I just think that algorithm written once should be able to handle cases for years without need of being rewritten. :)
I will optimize and correct my own answer and show it to the world.
This comment is hidden because it contains spoiler information about the solution