If you like, write a program which sorts cities according to the rules of city name game.
Each name of the city should start from the last letter in the previous city name. E.g.
Lviv -> v -> Viden -> n -> Neapolis -> s -> Sidney -> y -> Yokogama -> a -> Amsterdam -> m -> Madrid -> d -> Denwer
In the sorted list first letter of the first city and last letter of the last
shouldn't match anythingdoesn't have to be the same letter.
- You can assume city names have only letters.
- Program output should have same capitalization as input
% ./script Neapolis Yokogama Sidney Amsterdam Madrid Lviv Viden Denwer ["Lviv", "Viden", "Neapolis", "Sidney", "Yokogama", "Amsterdam", "Madrid", "Denwer"]