Use a string string to read your string, if you have carriage returns/end-of-line characters ('\n') delimiting each line. Instead of using std::cin, use a std::istringstream as your input source.
http://www.cplusplus.com/reference/sstream/istringstream/
I do not know if there are any \n to skip lines because I am using sshpass to ssh into a linux machine to run a command and retrieve the output as a string
If there are typical input delimiters that would cause std::cin to retrieve partial input from the stream, such as spaces, then a string stream will work the same way. A stream in C++ is a stream no matter where it comes from. The key thing is knowing the exact nature of the data string you are trying to muck with.