Program to find the length of the given string by using functions
#include <iostream>
#include <string> //for using string data type
#include <cstdio> //for using getline function to input string
using namespace std;
int main(){
string s;
cout << "Enter a string\n";
getline(cin, s); //taking input in the string
cout << "Length of the given string=" << s.length();
}
Output
Enter a string
Hello World
Length of the given string=11
