Ok, this is a homework task.
I will give you advice, but no code - at least no complete.
So what to do?
First of all you need to split the String. This can be done by using StringTokenizer
StringTokenizer oTokenizer = new StringTokenizer(strValue, ",");
You can then loop through the StringTokenizer by using
, which returns the next value. Remember
: loop. That's a
The String can be split by the String's own method String.split(String strDelimiter)
]. That one returns a String Array, which you can also loop through.
After the splitting is done you'll just have to compare each bit with the others. That's a loop in a loop. I'll let you figure that out, I guess that's the idea of this homework.
I strongly suggest to read the documentation for the String Object (see link above), cause that's one you will have to deal with very often.
Have fun and please ask when you have additional questions or need further explanation.