#include <iostream>
#include <sstream>
#include <limits>

int main()
{
    std::istringstream stm( "A: 10\n"
                            "B: 20\n"
                            "C: 30\n" ) ;

    constexpr char delimiter = ':' ;
    const auto max = std::numeric_limits<std::streamsize>::max() ;

    int number ;
    while( stm.ignore( max, delimiter ) >> number ) std::cout << number << '\n' ;
}
