How to input strings into stack until newline in C++? : i/p - hello world
I've to input the 2 strings word by word into the stack.
 `stack<string> st;`   
`string str;
``while(str!="\n")`
    {

    cin>>str;
    st.push(str);
 }

It's executing infinitely.