sorted the inputs by alpha-ascii order