Could use a sorted dict which maps the lower case values to the actual case.