# HackerEarth Seven-Segment Display problem solution

In this HackerEarth Seven-Segment Display problem solution, you all must have seen a seven-segment display. Alice got a number written in a seven-segment format where each segment was created 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 possesses. Help Alice out by telling her that number.

## HackerEarth Seven-Segment Display problem solution.

`#include<bits/stdc++.h>using namespace std;#define ll long long int#define MOD 1000000007string s;ll t,a;void solve(){    ll i,j,k;    cin>>t;    a=a=a=6;    a=2;    a=a=a=5;    a=4;    a=3;    a=7;    while(t--)    {        cin>>s;        ll val=0;        for(i=0;i<s.size();i++)        {            val+=a[s[i]-'0'];        }        if(val%2==1)        {            cout<<"7";            val-=3;        }        while(val>=2)        {            val-=2;            cout<<"1";        }        cout<<"\n";    }}int main(){          solve();    return 0;}`