Click to See Complete Forum and Search --> : Major Text file problem


inhumanoid
October 21st, 1999, 08:39 AM
Sorry for the previous Post with my nick as the subject
Let's say I have a text files with names. I want a program or function to return the names that have the highest count within
that textfile. The program should return a maximum of four different strings (names). The strings should always be unique.
If there are less than four different names within a file the program should return less than four.
Here are some examples to explain my problem:
#########################
A text file containing:

Jack
John
Mick

Should return:

Jack
John
Mick
#########################
A text file containing:

Jack
John
John
Jack
Mick

Should return:

John
Jack
Mick

#########################
A text file containig:

Jack
Jack
Jack
John
John
Mick
Buck
Buck
Buck
Trent

Should return:

Jack
John
Buck
Trent

The order of the returned strings doesn't matter that much. The important thing is that the names with the highest count get returned...

Hope someone can solve this one

Eis
October 21st, 1999, 08:54 AM
look at your other posting ;)