Arrange strings

given a set of strings , sort them in the following manner such that next string should start with last letters of previous string. Need to implement. Hint would be appreciated