I am sorry for confusing title, how do i make an array of these elements :
string [] anArray = new string[50];
anArray[0] = "New York";
anArray[1] = "London";
anArray[2] = "New York";
anArray[3] = "London";
anArray[4] = "New York";
anArray[5] = "Chicago";
Fall into an array like this :
anArray[0] = "New York";
anArray[1] = "New York";
anArray[2] = "New York";
anArray[3] = "London";
anArray[4] = "London";
anArray[5] = "Chicago";
Where elements are sorted by amount of equal elements are there in the array. And if for example anArray has an equal amount of elements like :
anArray[0] = "New York";
anArray[1] = "New York";
anArray[2] = "London";
anArray[3] = "London";
How do i make so that a program finds both of these elements and outputs something like: New York, amount of elements 2 London, amount of elements 2
I'll hope you understand, sorry if it may be confusing, thanks for any help here.