Skip to content

Commit

Permalink
[BOJ] 문자열
Browse files Browse the repository at this point in the history
  • Loading branch information
heerucan committed Dec 24, 2021
1 parent fb101d4 commit fa06536
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 0 deletions.
10 changes: 10 additions & 0 deletions BOJ/문자열/10809.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# 답안 참고
s = list(input())
import string
alphabet = list(string.ascii_lowercase)

for i in alphabet:
if i in s:
print(s.index(i), end=' ')
else:
print(-1, end=' ')
2 changes: 2 additions & 0 deletions BOJ/문자열/1152.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sentence = list(input().split())
print(len(sentence))
13 changes: 13 additions & 0 deletions BOJ/문자열/1157.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 답안 참고
s = input().upper()
setS = list(set(s)) # 중복없는 리스트
countList = [] # 글자수 리스트

for i in setS:
countList.append(s.count(i)) # 중복이 있는 글자수 세서 추가

if countList.count(max(countList)) > 1: # 글자수 리스트 중 최대값이 4라고 할 때
# 해당 원소를 가지고 있는 값이 여러개이면 중복이 있다는 것이니까 ?를 반환한다.
print("?")
else:
print(setS[countList.index(max(countList))]) # index가 위치 알려주는 메소드
6 changes: 6 additions & 0 deletions BOJ/문자열/11654.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
letter = input()

if letter in [0,1,2,3,4,5,6,7,8,9]:
print(chr(letter))
else:
print(ord(letter))
5 changes: 5 additions & 0 deletions BOJ/문자열/11720.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import sys

n = int(input())
data = list(map(int, sys.stdin.readline().strip()))
print(sum(data))
10 changes: 10 additions & 0 deletions BOJ/문자열/2675.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
n = 0
t = int(input())
while n<t:
r, s = list(input().split())
r = int(r)
s = list(s)
n += 1
for i in range(len(s)):
print(s[i]*r, end='')
print()

0 comments on commit fa06536

Please sign in to comment.