This is a good example yet simple, of how to go about solving common problems by breaking them down. It shows some of the best practices and code refactoring using functions and appropriate data structure. I hope it helps you improve the way you tackle problems. Again, this is not perfect. You got some ways to improve it?
http://github.com/CedricMurairi | http://twitter.com/CMurairi | https://www.linkedin.com/in/cedric-murairi/ | http://instagram.com/cedricmurairi/