문제출처 : https://www.acmicpc.net/problem/10809
code
#include <iostream>
using namespace std;
int main()
{
string S;
int alphabet[26];
cin >> S;
int len = S.length();
for (int i = 0; i < 26; i++)
alphabet[i] = -1;
for (int i = 0; i < len; i++)
{
if (alphabet[S[i] - 97] == -1)
alphabet[S[i] - 97] = i;
}
for (int i = 0; i < 26; i++)
cout << alphabet[i] << " ";
return 0;
}