Implement robust word counts and min/max | Amazon Interview Question