C. Digital Hijackers

2.9

17 votes
Ad-Hoc, Easy
Problem

You are going on a trip to Paris via plane. While you were in flight, you noticed a group of people talking in binary. Based on your observation you doubt them of being potential digital hijackers. But thanks to the Digital Fundamentals classes, you know how to convert binary to decimal . But you don't know how to convert decimal to character. But your friend, who is also on the flight knows ASCII and other characters codes values of every character. Now listen to the every binary word the group is saying and convert it to a number such that your friend can convert it into something readable.

INPUT FORMAT :
First line of input will contain an integer N, denoting number of words.
Following N lines will contain one string S consisting of binary numbers.

OUTPUT FORMAT :
Your output should contain N lines, each line containing the integer equivalent of the binary string .

CONSTRAINTS :
1≤ N ≤104
1≤ length of S ≤20

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

101 = 1x22 + 1x22 + 1x20 = 5

similarly, 100 = 1x22 + 1x22 + 1x22 = 4

Editor Image

?