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

코딩 1일 1문제! 오늘의 문제는 백준의 도비의 영어 공부 입니다.
2386번: 도비의 영어 공부
출력의 각 줄은 입력으로 주어진 소문자와 그 소문자 알파벳이 나타난 횟수로 이루어진다. 이때 문장에서 해당 알파벳이 소문자로 나타나던 대문자로 나타나던 모두 세야 한다.
www.acmicpc.net
👨🏻💻 코드 ( Solution )
from collections import Counter
def count_word(sentence, word):
count = 0
sentence = list(sentence)
cnt = Counter(sentence)
if word in cnt:
count = cnt[word]
return count
def dobbys_english_study(study_list):
answer_list = []
for study in study_list:
count = count_word(sentence=study[1], word=study[0])
answer = f"{study[0]} {count}"
answer_list.append(answer)
return answer_list
if __name__ == "__main__":
study_list = []
while True:
study = input()
if study == "#":
break
study = study.split()
word, sentence = study[0], " ".join(study[1:]).lower()
study_list.append((word, sentence))
answer_list = dobbys_english_study(study_list=study_list)
for answer in answer_list:
print(answer)
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] 9506번 : 모든 약수의 합 (Python) (0) | 2022.08.05 |
|---|---|
| [BaekJoon] 4096번 : 팰린드로미터 (Python) (0) | 2022.08.02 |
| [BaekJoon] 1673번 : 치킨 쿠폰 (Python) (0) | 2022.07.31 |
| [BaekJoon] 11282번 : 한글 (Python) (0) | 2022.07.30 |
| [BaekJoon] 11283번 : 한글 2 (Python) (0) | 2022.07.29 |
Comments