I have a text file with names stored in it:
Mike John Sarah James Mike Sarah Mike
The list contains names of all people who used the program (at the beginning user is asked to input a name). I need to find a way to print only the last three people who used the program without repetition. So my result is supposed to be “Mike, Sarah, James“. What is the best way to do this?