#include <stdio.h>
#include <string.h>
int main() {
char str[101];
int alp[26]={0};
scanf("%s",str);
// -1로 초기화
for (int i=0; i<26; i++) {
alp[i]=-1;
}
//문자열 길이만큼 반복
for(int i=0; i<strlen(str); i++) {
//alp 의 인덱스 찾기
int idx = str[i]-'a';
//alp의 인덱스에 값이 없으면 i번째 추가, 다른 숫자 잇으면 넘어감
if (alp[idx] == -1) {
alp[idx] = i;
}
}
for (int i=0; i<26; i++) {
printf("%d ",alp[i]);
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: