You are building the base-conversion feature of a pocket calculator. The calculator has the following properties:
0-9 and the capital letters A-F.Write a program that converts a number from one base to another and prints how the result would appear on the calculator's display.
Each line of input describes one conversion and contains three values separated by one or more spaces:
Extra spaces may appear before, between, or after the values. Keep reading and processing conversions until the end of the input.
For each conversion, print the converted number exactly as it would appear on the 7-digit display: right-justified within a field of width 7 (padded with leading spaces). Digits greater than 9 are shown as the capital letters A-F.
If the converted number needs more than 7 digits it cannot fit on the display; in that case print ERROR instead, also right-justified within the width-7 field.