Problem in question first in stl string sort

in my first question string sort my code is working but i have crossed my time limit someone please help me
code link: https://ide.codingblocks.com/s/76647
question link: https://online.codingblocks.com/player/21507/content/4990/4738

the logic is that if string1 has something in common with string2, then there first letter will be common too.
so just limit your compare function to the first element of the strings.