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
- alter
- set
- string
- union_find
- NIO
- html
- deque
- 스프링부트
- map
- sql
- javascript
- BFS
- List
- priority_queue
- CSS
- Java
- date
- GC로그수집
- 스택
- Properties
- 리소스모니터링
- spring boot
- dfs
- Calendar
- 힙덤프
- Union-find
- math
- scanner
- JPA
- 큐
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 |