출처 : https://www.acmicpc.net/problem/10809
10809번: 알파벳 찾기
각각의 알파벳에 대해서, a가 처음 등장하는 위치, b가 처음 등장하는 위치, ... z가 처음 등장하는 위치를 공백으로 구분해서 출력한다. 만약, 어떤 알파벳이 단어에 포함되어 있지 않다면 -1을 출
www.acmicpc.net
#include <iostream>
#include <string>
using namespace std;
int main(void) {
string sInput;
int nT;
cin >> sInput;
for(int i = 97; i < 123; i++) {
nT = sInput.find(i);
if (nT > sInput.length()){
cout << -1 << " ";
continue;
}
cout << sInput.find(i) << " ";
}
return 0;
}