'How does stringstream works with operators << and >>?

Input would be something like : 07:10 I'm getting correct value for hour but for min, I'm getting weird values.

void timeConversion(string s) 
{
    int hour,min;
    
    stringstream ss;
    ss << s.substr(0,2);
    ss >> hour;
    cout << hour <<endl;
    
    ss << s.substr(3,2);
    ss >> min;
    cout << min<<endl;    
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source