250x250
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 | 29 | 30 | 31 |
Tags
- 재귀
- REST API
- 파이싼
- Retrieval
- 1002
- 밑바닥부터 시작하는 딥러닝
- streamlit
- Python
- 기계학습
- n과 m
- 손실함수
- video retireval
- 15649
- 백준
- 신경망 학습
- 1101
- 경사하강법
- 9020
- 티스토리챌린지
- 오블완
- 4948
- BOJ
- 그리디 알고리즘
- 파이썬
- end to end
- 가상환경
- N-Queen
- 개발환경
- pyenv
- 백트래킹
Archives
- Today
- Total
파이톨치
[백준] 1213 파이썬 본문
728x90
from string import ascii_uppercase
alphabet_dict = {}
for i in ascii_uppercase:
alphabet_dict[i] = 0
# print(alphabet_dict)
s = input()
for i in range(len(s)):
alphabet_dict[s[i]] += 1
# print(alphabet_dict)
answer = ""
check = 0
mid = ""
for i in ascii_uppercase:
if alphabet_dict[i]%2==0:
alphabet_dict[i] -= 2
while alphabet_dict[i]>=0:
answer += i
alphabet_dict[i] -= 2
# 홀수인 경우
else:
if check == 1:
check += 1
break
check = 1
alphabet_dict[i] -= 2
while alphabet_dict[i]>=0:
answer += i
alphabet_dict[i] -= 2
mid = i
if check == 2:
print("I'm Sorry Hansoo")
else:
print(answer + mid + answer[::-1])
728x90