文字列内の一意の文字を数えたい
入力:
"aabbccdefgh"
出力:
8
私のコードは機能せず、エラーをスローします:
私のコード:
public class test {
public static void main(String[] args) {
String[] s = {""};
int counter = 0;
int pom = 0;
for(int i = 0; i < s.length; i++){
for(int y = 0; y < 128; y++){
if(s[i].compareTo(args[y])>0){
pom++;
}
}
}
while(pom == 1){
counter++;
}
System.out.println(counter);
}
}
誰かが私が間違っているところを指摘できますか?