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 |
Tags
- 홀수
- 알고리즘
- java
- parseInt
- 자료형
- IaaS
- 최대공약수
- valueof
- 데이터타입
- PaaS
- 2진수
- 최대공배수
- 백준
- aws
- 11004
- algorithm
- SaaS
- 문자열 숫자 변환
- 리스트
- 짝수
- INT
- 프로그래머스
- 11652
- Python
- 온프레미스
- 웹 서버
- 프로젝트 생성
- level1
- 유클리드 호제법
- IntelliJ
Archives
- Today
- Total
Ga0Lee
[알고리즘] 알파벳 찾기 백준 10809 (Python) 본문
알파벳 개수 찾는 문제와 거의 동일하다.
리스트를 -1로 초기화하고 해당 알파벳의 인덱스에 입력받은 알파벳의 인덱스 값을 넣어주면 된다.
코드
import sys
alphabet =[-1] * 26
str = sys.stdin.readline().rstrip()
for i in range(len(str)):
if(alphabet[ord(str[i]) - 97] == -1 ):
alphabet[ord(str[i]) - 97] = i
print(*alphabet)
입출력
'Algorithm' 카테고리의 다른 글
[알고리즘] 단어 길이 재기 백준 2743 (Python) (0) | 2022.01.17 |
---|---|
[알고리즘] 문자열 분석 백준 10820 (Python) (0) | 2022.01.17 |
[알고리즘] 알파벳 개수 백준 10808 (Python) (0) | 2022.01.17 |
[알고리즘] 덱 백준 10866 (Python) (0) | 2022.01.16 |
[알고리즘] 큐 백준 10845 (Python) (0) | 2022.01.14 |