Write a program that counts the number of characters in the sentence entered by the user and displays it on the screen.
Expert's answer
#include<iostream>#include<string>usingnamespace std;
intmain(){
string str;
cout << "Enter your sentence\n";
getline(cin, str);
cout << "Number of characters per line is " << str.size();
return0;
}