Write a program that accepts an input string from the user, and determines how m
ID: 3768241 • Letter: W
Question
Write a program that accepts an input string from the user, and determines
how many times a user-specified character appears within the string. (Hint:
Look up the 's' option of the input function using the MATLAB Help
Browser.)
Actually you have to get 2 things from the user:
The user-specified input string to search in
The user-specified character to search for (in order to count how many times it occurs)
If the user enters a string instead of a single character you should just use the first character of the string.
Example Run #1
Enter a string to search: Look for me please
Enter a character to look for: e
e was found 3 times in Look for me please
Example Run #2
Enter a string to search: This is another test
Enter a character to look for: stop
s was found 3 times in This is another test
Example Run #3
Enter a string to search: This is another test
Enter a character to look for: z
z was found 0 times in This is another test