Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 프로그래머스
- 편스토랑
- github
- hackerrank
- leetcode
- 맥북
- gs25
- 자연어처리
- 우분투
- PYTHON
- 코로나19
- dacon
- AI 경진대회
- ubuntu
- 파이썬
- 프로그래머스 파이썬
- Baekjoon
- 편스토랑 우승상품
- Git
- ChatGPT
- programmers
- 캐치카페
- Kaggle
- Real or Not? NLP with Disaster Tweets
- 금융문자분석경진대회
- Docker
- 백준
- 더현대서울 맛집
- 데이콘
- SW Expert Academy
Archives
- Today
- Total
솜씨좋은장씨
[BaekJoon] 5357번 : Dedupe (Python) 본문
728x90
반응형

코딩 1일 1문제! 오늘의 문제는 백준의 Dedupe 입니다.
5357번: Dedupe
Redundancy in this world is pointless. Let’s get rid of all redundancy. For example AAABB is redundant. Why not just use AB? Given a string, remove all consecutive letters that are the same.
www.acmicpc.net
👨🏻💻 코드 ( Solution )
def dedupe(dup_string):
dedupe_string = [dup_string[0]]
for word in dup_string[1:]:
if word != dedupe_string[-1]:
dedupe_string.append(word)
return "".join(dedupe_string)
if __name__ =="__main__":
for _ in range(int(input())):
dup_string = input()
print(dedupe(dup_string=dup_string))
GitHub - SOMJANG/CODINGTEST_PRACTICE: 1일 1문제 since 2020.02.07
1일 1문제 since 2020.02.07. Contribute to SOMJANG/CODINGTEST_PRACTICE development by creating an account on GitHub.
github.com
'Programming > 코딩 1일 1문제' 카테고리의 다른 글
[BaekJoon] 26711번 : A+B (Python) (2) | 2022.12.28 |
---|---|
[BaekJoon] 26574번 : Copier (Python) (0) | 2022.12.27 |
[BaekJoon] 26545번 : Reverse (Python) (0) | 2022.12.24 |
[BaekJoon] 10189번 : Hook (Python) (0) | 2022.12.22 |
[BaekJoon] 26545번 : Mathematics (Python) (0) | 2022.12.21 |