Answer:
I am writing Python program.
string = input("Enter a string: ")
print(string.count(' '))
Explanation:
The first statement takes input string from the user.
input() is used to read the input from the user.
The next statement uses count() function to count the number of times the specified object which is space ' ' here occurs in the string.
The print() function is used to return the number of times the space occurs in the string entered by the user.
Output:
Enter a string: How are you doing today?
4
The screenshot of program and its output is attached.