5. Write a program which reads in an integer value between 2 and 10 as the
base of a number system, and then reads in a positive number written to that
base, and print its equivalent value in decimal number system.
Requirement: read in the second integer character by character using
getchar(); skip over any leading non-valid (i.e. not a digit between zero and
base-1) characters, then read valid characters until an invalid one is
encountered. Assume the length of the second integer is no longer than 10.
Test cases:
Input Output
========== ======
10 1234 1234
8 77 63
2 1111 15