key index sorting for string