-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
154 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
s = input() | ||
alphabet = [] | ||
|
||
for i in range(0, 26): | ||
alphabet.append(-1) | ||
|
||
for i in range(len(s)): | ||
if alphabet[ord(s[i])-97] == -1: | ||
alphabet[ord(s[i])-97] = i | ||
|
||
|
||
for i in range(len(alphabet)): | ||
print(alphabet[i], end=" ") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
str = input() | ||
alphabet = [] | ||
|
||
for i in range(26): | ||
alphabet.append(0) | ||
|
||
# 알파벳 개수 세기 | ||
for i in str: | ||
if ord(i) >= 97: | ||
alphabet[ord(i)-97] = alphabet[ord(i)-97] + 1 | ||
else: | ||
alphabet[ord(i)-65] = alphabet[ord(i)-65] + 1 | ||
|
||
# 가장 많은 알파벳 대문자로 출력하기 | ||
max = 0 | ||
maxIdx = -1 | ||
for i in range(len(alphabet)): | ||
if max < alphabet[i]: | ||
max = alphabet[i] | ||
maxIdx = i | ||
|
||
for i in range(len(alphabet)): | ||
if i != maxIdx and max == alphabet[i]: | ||
max = -1 | ||
|
||
if max == -1: | ||
print("?") | ||
else: | ||
print(chr(maxIdx + 65)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
str = input() | ||
alphabet = [] | ||
|
||
for i in range(26): | ||
alphabet.append(0) | ||
|
||
# 알파벳 개수 세기 | ||
for i in str: | ||
if ord(i) >= 97: | ||
alphabet[ord(i)-97] = alphabet[ord(i)-97] + 1 | ||
else: | ||
alphabet[ord(i)-65] = alphabet[ord(i)-65] + 1 | ||
|
||
# 가장 많은 알파벳 대문자로 출력하기 | ||
max = 0 | ||
maxIdx = -1 | ||
for i in range(len(alphabet)): | ||
if max < alphabet[i]: | ||
max = alphabet[i] | ||
maxIdx = i | ||
|
||
for i in range(len(alphabet)): | ||
if i != maxIdx and max == alphabet[i]: | ||
max = -1 | ||
|
||
if max == -1: | ||
print("?") | ||
else: | ||
print(chr(maxIdx + 65)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
n = input() | ||
print(ord(n)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
n = int(input()) | ||
data = input() | ||
sum = 0 | ||
for i in data: | ||
sum = sum + int(i) | ||
print(sum) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
n = int(input()) # 소문자 단어 | ||
|
||
# 단어 입력받기 | ||
wordList = [] | ||
for i in range(n): | ||
wordList.append(input()) | ||
|
||
# 그룹단어 체크하는 함수 True/False | ||
def checkGroup(word): | ||
alphabet = [] | ||
for i in range(26): | ||
alphabet.append(0) | ||
|
||
alphabet[ord(word[0])-97] = alphabet[ord(word[0])-97] + 1 | ||
|
||
for i in range(1, len(word)): | ||
if word[i] != word[i-1] and alphabet[ord(word[i])-97] != 0: | ||
return False | ||
else: | ||
alphabet[ord(word[i]) - 97] = alphabet[ord(word[i])-97] + 1 | ||
return True | ||
|
||
result = 0 | ||
|
||
for i in range(len(wordList)): | ||
if checkGroup(wordList[i]) == True: | ||
result = result + 1 | ||
|
||
print(result) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
t = int(input()) | ||
|
||
for i in range(t): | ||
r, s = input().split() | ||
r = int(r) | ||
for j in s: | ||
print(j*r, end="") | ||
print() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
a, b = map(int, input().split()) | ||
|
||
a = (a % 10)*100 + (a//10%10) * 10 + (a//100) | ||
b = (b % 10)*100 + (b//10%10) * 10 + (b//100) | ||
|
||
if a > b: | ||
print(a) | ||
else: | ||
print(b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
word = input() # 알파벳 소문자, - = 로만 이루어져 있는 최대 100글자 단어 | ||
list = ['c=', 'c-', 'dz=', 'd-', 'lj', 'nj', 's=', 'z='] | ||
|
||
for i in range(len(list)): | ||
word = word.replace(list[i], '1') | ||
|
||
print(len(word)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
w = input() | ||
ans = 0 | ||
|
||
for i in w: | ||
if i <= 'C': | ||
ans = ans + 3 | ||
elif i <= 'F': | ||
ans = ans + 4 | ||
elif i <= 'I': | ||
ans = ans + 5 | ||
elif i <= 'L': | ||
ans = ans + 6 | ||
elif i <= 'O': | ||
ans = ans + 7 | ||
elif i <= 'S': | ||
ans = ans + 8 | ||
elif i <= 'V': | ||
ans = ans + 9 | ||
else: | ||
ans = ans + 10 | ||
|
||
print(ans) |