First, you're missing your using std namespace; declaration, that's a bad habit to form and it actually makes your code slightly harder to read.
To answer your question though, it's because "std::getline()" doesn't skip whitespace: http://www.cplusplus.com/reference/string/string/getline/ . Call the "find()" and "erase()" member functions for 'std::string' if you want to get rid of it.