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
- Real or Not? NLP with Disaster Tweets
- 프로그래머스
- dacon
- 더현대서울 맛집
- Kaggle
- 백준
- 코로나19
- leetcode
- Baekjoon
- 자연어처리
- AI 경진대회
- gs25
- 편스토랑
- 데이콘
- programmers
- hackerrank
- 캐치카페
- 맥북
- 편스토랑 우승상품
- ChatGPT
- Git
- 파이썬
- ubuntu
- 금융문자분석경진대회
- PYTHON
- 프로그래머스 파이썬
- 우분투
- Docker
- SW Expert Academy
- Today
- 1
- Total
- 2,398,405
솜씨좋은장씨
[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 |
0 Comments