Ruby String Exercises: Count the occurrences of a specified character in a given string
Write a Ruby program to count the occurrences of a specified character in a given string.

Ruby Code:
Output:
1 2 1
Flowchart:

Ruby Code Editor:
Contribute your code and comments through Disqus.
Previous: Write a Ruby program to check whether a string starts with an other string.
Next: Write a Ruby program to sort a string's characters alphabetically.
What is the difficulty level of this exercise?