Count word

Problem from 101cproblems.com:
Write a program which will take a sentence as input and tell us how many words are there. [If user gives input “I love Bangladesh”, then the output should be: 3]

code: