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

코딩 1일 1문제! 오늘의 문제는! 백준의 두라무리 휴지 입니다.
25178번: 두라무리 휴지
기령이는 어느 날 캠릿브지 대학의 연결구과에 대해 알게 되었다. 캠릿브지 대학의 연결구과란, 단어를 이해함에 있어 한 단어 안에서 글자들이 어떤 순서로 배열되어 있는지는 중요하지 않고,
www.acmicpc.net
👨🏻💻 코드 ( Solution )
from collections import Counter
def count_words(word):
return Counter(word)
def remove_nouns_from_word(word):
nouns = ['a', 'e', 'i', 'o', 'u']
return "".join([w for w in list(word) if w not in nouns])
def duramuri_huji(word1, word2):
answer = "NO"
cnt1, cnt2 = count_words(word=word1), count_words(word=word2)
word1_non_noun = remove_nouns_from_word(word=word1)
word2_non_noun = remove_nouns_from_word(word=word2)
condition1 = cnt1 == cnt2
condition2 = (word1[0] == word2[0]) and (word1[-1] == word2[-1])
condition3 = word1_non_noun == word2_non_noun
if condition1 and condition2 and condition3:
answer = "YES"
return answer
if __name__ == "__main__":
N = int(input())
word1 = input()
word2 = input()
print(duramuri_huji(word1=word1, word2=word2))
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문제' 카테고리의 다른 글
[Programmers] 콜라 문제 (Python) (0) | 2022.10.24 |
---|---|
[BaekJoon] 23348번 : 스트릿 코딩 파이터 (Python) (0) | 2022.10.23 |
[BaekJoon] 5717번 : 상근이의 친구들 (Python) (0) | 2022.10.21 |
[BaekJoon] 16693번 : Pizza Deal (Python) (0) | 2022.10.20 |
[Programmers] 삼총사 (Python) (0) | 2022.10.19 |