WS Manipulator function
The abbreviation of ws is white space. This function excludes the former additional space in the string which are taken on the input stream by the keyboard and then can be displayed. If the string includes spaces in between (as in case of normal sentence of words), then the first word till the space is encountered is only considered.
For demonstration of the concept, I have taken two values which can be seen in the screenshot.
The first input string is " hello!mynameisAbhinav". There are two unnecessary additional white spaces in the beginning. This is removed by taking input of the ws function in the console. The output string becomes "hello!mynameisAbhinav" .
The second input is " hello! my name is Abhinav". Similar to that of previous example there are two white spaces, but the string is discontinuous. So the ws function will take input till the first word ends, which is " hello!". The output string will be will be "hello!".
The code demonstrating the implementation of the function is:
using namespace std;
cout<<"Enter the line of text \n";
cout<<"Entered line of text after implementing ws function is "<<text<<endl;
The screenshots of the code are displayed below: