250x250
Notice
Recent Posts
Recent Comments
Link
반응형
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
Tags
- date
- CSS
- JPA
- alter
- Java
- spring boot
- javascript
- 힙덤프
- set
- 리소스모니터링
- 스프링부트
- Calendar
- dfs
- Union-find
- map
- string
- NIO
- GC로그수집
- html
- List
- BFS
- scanner
- union_find
- 스택
- math
- deque
- 큐
- sql
- priority_queue
- Properties
Archives
- Today
- Total
매일 조금씩
[C++] 백준 10809번: 알파벳 찾기 본문
728x90
반응형
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(void) {
string s;
cin >> s;
int count[26];
for (int i = 'a'; i <= 'z'; i++) {
for (int j = 0; j < s.size(); j++) {
if (s[j] == i) {
count[i] = j;
break;
}
else {
count[i] = -1;
}
}
cout << count[i] << " ";
}
return 0;
}
728x90
반응형
'알고리즘' 카테고리의 다른 글
[C++] 백준 2941번: 크로아티아 알파벳 (0) | 2019.09.29 |
---|---|
[C++] 백준 1764번 : 듣보잡 (0) | 2019.09.28 |
[C++] 백준 11383번: 뚊 (0) | 2019.09.10 |
[C++] 백준 2799번: 블라인드 (0) | 2019.09.09 |
[C++] 백준 2839번: 설탕배달 (0) | 2019.09.06 |