백준 10809 c++

magicdrill·2024년 3월 26일
0

백준 문제풀이

목록 보기
209/655

백준 10809 c++

#include <iostream>
#include <cstring>
#include <cstdlib>

using namespace std;

int main(void)
{
	char S[101];
	int i, j;
	bool t = 0;

	cin >> S;

	for (i = 97; i <= 122; i++)
	{
		for (j = 0; j < strlen(S); j++)
		{
			t = 0;
			if ((int)S[j] == i)
			{
				t = 1;
				break;
			}
			else
			{
				;
			}
		}
		if (t == 1)
		{
			cout << j;
		}
		else
		{
			cout << "-1";
		}
		cout << " ";
	}

	return 0;
}

0개의 댓글