A .cpp file to sort the array by dictionary sort