Problem descriptionhexadecimal is very important and useful for computer programmers. you are requested to provide a hexadecimal view for given data. the hexadecimal view is made up of one or more rows. every row does t the last one represents 16 characters. each row consists
Of three columns separated by a space:
* ADDR: The 4-digit hexadecimal beginning address of this row.
* Dump: The hexadecimal representation of this row, separating every two characters by a whitespace. If there are less than 16 characters in the last row, pad it with spaces.
* Text: the ASCII translation of this row, with uppercase characters converted to lowercase and lowercase characters converted to uppercase.
Use lowercase for the letter digits. See sample for more details.
Inputthere are multiple test cases. Each line is a test case. The line is made up of no less than 1 and no more than 4096 printable characters including spaces.
Outputfor each test case, output its hexadecimal view. Do not output any extra spaces after the last character of text.
Sample Input
Hex dump # include <cstdio> printf ("Hello, world! \ N "); main = Do Getline> = print. Sum. Map read. Words
Sample output
0000: 4865 7820 4475 6d70 hex dump0000: 2369 6e63 6c75 6465 203c 6373 7464 0000 696f # include <cstdio0010: 3E> 7072: 7466 696e 2822 4865 2057 6c6c 6f2c printf ("hello, w0010: 6f72 6c64 215c 6e22 293b orld! \ N "); 0000: 6d61 696e 203d 2064 6f20 6765 744c 696e main = Do getlin0010: 6520 3e3e 3d20 7072 696e 7420 2e20 7375 e >>= print. su0020: 6d20 2e20 6d61 7020 7265 6164 2077 M. map read. w0030: 6f72 6473 ords simulation, note that the last column does not need to be completed, and note that the number of rows when the number of characters is an integer multiple of 16. Language: C ++ code:# Include <iostream> # include <cctype> # include <cstring> # include <cstdio> using namespace STD; int main () {char s [4100]; while (gets (s) {int Len = strlen (s); int line; If (LEN % 16 = 0) line = Len/16; else line = Len/16 + 1; for (INT I = 0; I <line; I ++) {int COUNT = 0; printf ("%. 4x: ", I <4); For (Int J = I * 16; s [J] & J <I * 16 + 16; j ++) {printf ("%. 2x ", s [J]); count + = 2; If (J & 1) {putchar (''); count ++ ;}} while (count ++ <40) putchar (''); For (Int J = I * 16; s [J] & J <I * 16 + 16; j ++) {If (islower (s [J]) putchar (toupper (s [J]); else putchar (tolower (s [J]);} printf ("\ n") ;}} return 0 ;}