Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Count Keyword Occurrences | Fundamentals of Strings
C# Strings and Text Processing

bookChallenge: Count Keyword Occurrences

Task

Swipe to start coding

You are given a text and a search keyword. Your program must:

  1. Count how many times the keyword appears in the text (non-overlapping matches).

  2. Find the index of the first occurrence.

  3. Find the index of the last occurrence.

  4. Print results in a clear, consistent format.

The search must be case-insensitive.

Solution

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 1. ChapterΒ 7
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

Suggested prompts:

Can you explain this in simpler terms?

What are the next steps I should take?

Can you provide an example?

close

bookChallenge: Count Keyword Occurrences

Swipe to show menu

Task

Swipe to start coding

You are given a text and a search keyword. Your program must:

  1. Count how many times the keyword appears in the text (non-overlapping matches).

  2. Find the index of the first occurrence.

  3. Find the index of the last occurrence.

  4. Print results in a clear, consistent format.

The search must be case-insensitive.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 1. ChapterΒ 7
single

single

some-alt