Please do not have a python script for something as trivial as this. Use sort and tr.