Skip to content

Commit fa06536

Browse files
committed
[BOJ] 문자열
1 parent fb101d4 commit fa06536

File tree

6 files changed

+46
-0
lines changed

6 files changed

+46
-0
lines changed

BOJ/문자열/10809.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# 답안 참고
2+
s = list(input())
3+
import string
4+
alphabet = list(string.ascii_lowercase)
5+
6+
for i in alphabet:
7+
if i in s:
8+
print(s.index(i), end=' ')
9+
else:
10+
print(-1, end=' ')

BOJ/문자열/1152.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
sentence = list(input().split())
2+
print(len(sentence))

BOJ/문자열/1157.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# 답안 참고
2+
s = input().upper()
3+
setS = list(set(s)) # 중복없는 리스트
4+
countList = [] # 글자수 리스트
5+
6+
for i in setS:
7+
countList.append(s.count(i)) # 중복이 있는 글자수 세서 추가
8+
9+
if countList.count(max(countList)) > 1: # 글자수 리스트 중 최대값이 4라고 할 때
10+
# 해당 원소를 가지고 있는 값이 여러개이면 중복이 있다는 것이니까 ?를 반환한다.
11+
print("?")
12+
else:
13+
print(setS[countList.index(max(countList))]) # index가 위치 알려주는 메소드

BOJ/문자열/11654.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
letter = input()
2+
3+
if letter in [0,1,2,3,4,5,6,7,8,9]:
4+
print(chr(letter))
5+
else:
6+
print(ord(letter))

BOJ/문자열/11720.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import sys
2+
3+
n = int(input())
4+
data = list(map(int, sys.stdin.readline().strip()))
5+
print(sum(data))

BOJ/문자열/2675.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
n = 0
2+
t = int(input())
3+
while n<t:
4+
r, s = list(input().split())
5+
r = int(r)
6+
s = list(s)
7+
n += 1
8+
for i in range(len(s)):
9+
print(s[i]*r, end='')
10+
print()

0 commit comments

Comments
 (0)