All Tracks Basic Programming Input/Output Basics of Input/Output Problem

Seven-Segment Display
/

Ad-Hoc, Basic Programming, Input/Output

Problem
Editorial
Analytics

You all must have seen a seven segment display.If not here it is:

Alice got a number written in seven segment format where each segment was creatted used a matchstick.

Example: If Alice gets a number 123 so basically Alice used 12 matchsticks for this number.

Alice is wondering what is the numerically largest value that she can generate by using at most the matchsticks that she currently possess.Help Alice out by telling her that number.

 

Input Format:

First line contains T (test cases).

Next T lines contain a Number N.

Output Format:

Print the largest possible number numerically that can be generated using at max that many number of matchsticks which was used to generate N.

Constraints:

\(1 \le T \le 100\)

\(1 \le length(N) \le 100\)

SAMPLE INPUT
2
1
0
SAMPLE OUTPUT
1
111
Explanation

If you have 1 as your number that means you have 2 match sticks.You can generate 1 using this.

If you have as your number that means you have match sticks.You can generate 111 using this.

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB

Best Submission

Similar Problems

Contributors

This Problem was Asked in

Initializing Code Editor...
Notifications
View All Notifications

?