public class nrlSports {
public static void main(String[] args){
String[] direction = {"north", "north", "east", "south", "south", "south", "north", "north"};
for(int i=0; i<direction.length; i++) {
int count = 0;
for(int j = 0; j < direction.length; j++)
if(direction[i].equals(direction[j])) {
count++;
}
System.out.println(direction[i] + " (" + count + ")");
}
}
}
出力は次のとおりです。北 (4) 北 (4) 東 (1) 南 (3) 南 (3) 南 (3) 北 (4) 北 (4)
これらの重複した値を削除して、出力が次のようになるようにするにはどうすればよいですか: 北 (4) 東 (1) 南 (3)