Solution for Week 6: tries and auto-completion