Count Words in String Problem

Count Words in String Problem — ExecCode School DSA Practice

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

Problem description

You are given a line of text. Your task is to count how many words are in the text. Print only that count.

Examples

Input This is a sentence; Output 4. Input OneWord; Output 1

Constraints

1 <= n <= 10^5

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