백준 단계별로 풀어보기 - 문자열 (Python)

Updated:

단계별로 풀어보기의 문자열 파트입니다.
이 게시물은 제가 문제를 풀 때 마다 업데이트 할 예정입니다.

아스키 코드 - 11654번

print(ord(input()))

숫자의 합 - 11720번

n = input()
a = input()
answer = 0

for i in a:
    answer += int(i)
    
print(answer)

알파벳 찾기 - 10809번

s = input()
a = [-1] * 26

for i, v in enumerate(s):
    if a[ord(v) - 97] == -1:
        a[ord(v) -97] = i

for i in a:
    print(i)

문자열 반복 - 2675번

for _ in range(int(input())):
    idx, word = input().split()
    for i in word:
        print(i * int(idx), end = '')
    print()

단어 공부 - 1157번

word = input().upper()
a = []

for i in range(65, 91):
    a.append(word.count(chr(i)))
    
print('?' if a.count(max(a)) > 1 else chr(a.index(max(a)) + 65))

단어의 개수 - 1152번

words = list(input().split())
print(len(words))

상수 - 2908번

a, b = input().split()
print(max(int(a[::-1]), int(b[::-1])))

다이얼 - 5622번

word = input()
answer = 0

for i in word:
    temp = ord(i) - 65
    if temp <= 14:
        answer += temp // 3 + 3
    elif temp >= 15 and temp <= 18:
        answer += 8
    elif temp >= 19 and temp <= 21:
        answer += 9
    else:
        answer += 10
            
print(answer)

크로아티아 알파벳 - 2941번

c = input().count
print(c('') - 1 - sum(map(c, ['-','=','nj','lj','dz='])))

그룹 단어 체커 - 1316번

result = 0
for i in range(int(input())):
    word = input()
    if list(word) == sorted(word, key=word.find):
        result += 1
print(result)

Categories:

Updated: