Count Words in Sentence Problem

Count Words in Sentence Problem — ExecCode School DSA Practice

Solve the Count Words in Sentence problem on ExecCode. Free online school DSA practice in Strings - Basics. Write and run code in Java, C++, Python — no signup required to run.

Problem description

You are given one sentence. Your task is to count how many words are in the sentence. Print only that count.

Examples

Input This is a sentence; Output 4. Input One word; Output 2

Constraints

1 <= len(S) <= 10^4

Practice Count Words in Sentence free on ExecCode. Browse DSA problems, topic map, and placement guides.