One by one check for each character if it is a numeric character
for i in range ( len ( s ) ) : NEW_LINE INDENT if ( s [ i ] >= '0' and s [ i ] <= '9' ) : NEW_LINE INDENT num_found_so_far += s [ i ] NEW_LINE DEDENT elif ( len ( num_found_so_far ) > 0 ) : NEW_LINE DEDENT