The problem is that cin only reads until it reaches a space or end of line. To get input strings that contain spaces you will need to use the getline function instead.
cin
getline
replace cin >> input; with getline(cin, input);
cin >> input;
getline(cin, input);