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
- 금융문자분석경진대회
- AI 경진대회
- Docker
- ChatGPT
- 우분투
- 맥북
- 편스토랑 우승상품
- Baekjoon
- gs25
- 편스토랑
- programmers
- 프로그래머스 파이썬
- Kaggle
- 데이콘
- github
- Real or Not? NLP with Disaster Tweets
- hackerrank
- 더현대서울 맛집
- 캐치카페
- 백준
- leetcode
- 자연어처리
- 코로나19
- 파이썬
- 프로그래머스
- dacon
- SW Expert Academy
- ubuntu
- PYTHON
- Git
Archives
- Today
- Total
솜씨좋은장씨
[leetCode] 434. Number of Segments in a String (Python) 본문
Programming/코딩 1일 1문제
[leetCode] 434. Number of Segments in a String (Python)
솜씨좋은장씨 2020. 8. 2. 23:31728x90
반응형
Count the number of segments in a string, where a segment is defined to be a contiguous sequence of non-space characters.
Please note that the string does not contain any non-printable characters.
Example:
Input: "Hello, my name is John"
Output: 5
Solution
class Solution:
def countSegments(self, s: str) -> int:
answer = len(s.split())
return answer
'Programming > 코딩 1일 1문제' 카테고리의 다른 글
[leetCode] 290. Word Pattern (Python) (0) | 2020.08.04 |
---|---|
[leetCode] 205. Isomorphic Strings (Python) (0) | 2020.08.03 |
[leetCode] 1528. Shuffle String (Python) (0) | 2020.08.02 |
[leetCode] 884. Uncommon Words from Two Sentences (Python) (0) | 2020.07.31 |
[leetCode] 349. Intersection of Two Arrays (Python) (1) | 2020.07.30 |
Comments