Little Jay

[C++] 백준 10809번 알파벳 찾기 본문

알고리즘/BOJ

[C++] 백준 10809번 알파벳 찾기

Jay, Lee 2021. 3. 15. 23:30

string의 find 메소드를 사용하면 간단하게 풀 수 있다.

#include <iostream>
#include <string>
using namespace std;

int main() {

	string s;
	cin >> s;
	string comp = "abcdefghijklmnopqrstuvwxyz";

	int arr[25]{ -1 };

	for (int i = 0; i < comp.length(); i++) {
		cout << (int)s.find(comp[i]) << " ";
	}

	return 0;
}

'알고리즘 > BOJ' 카테고리의 다른 글

[C++] 백준 10773번 제로  (0) 2021.03.21
[C++] 백준 1152번 단어의 개수  (0) 2021.03.21
[C++] 백준 2577번 숫자의 개수  (0) 2021.03.14
[C++] 백준 10814번 나이순 정렬  (0) 2021.03.11
[C++] 백준 10250번 ACM호텔  (0) 2021.03.11
Comments