class Solution {
public int[] solution(String s) {
int[] answer = {};
char[] c = s.toCharArray();
answer = new int[s.length()];
for(int i=0; i<s.length(); i++){
int index = s.indexOf(c[i]);
if(index ==i)
answer[i]=-1;
else{
for(int j=index; j<i; j++){
if(c[i]==c[j])
answer[i]= i-j;
}
}
}
return answer;
}
}