- Reverse a String 1
- Reverse Each Word
- Reverse a Sentence
- Palindrome
- Find Words
- CountIng Search
- Unique Characters
-
Java Sandwich - Anagrams 1
- Anagrams 2
- Counting Search 2
Java String Resources:
Counting Search 2
Collapse Content
Show Content
Counting Search 1 asked how many times "ing" appears in a given String. In this challenge, you need to count how many words in a String end with "ing" or "ings" (lowercase), but ignore other appearances of "ing". The end of a word are any characters that do not have a letter right after them, but they can have punctuation.
For example, the following sentence contains 4 "ing" words.
1 2 3 4 Pringle was searching on Bing for Singing Kings.
Note that "Singing" only counts once, and "Pringle" doesn't count at all.
Challenge
Print the number of words that end with "ing" or "ings" in each line of text.
Please sign in or sign up to submit answers.
Alternatively, you can try out Learneroo before signing up.