Leaderboard
Showing:
Find the position
Basic Accuracy: 37.01% Submissions: 681 Points: 1

Consider a series of numbers composed of only digits 4 and 7. First few numbers in the series are 4, 7, 44, 47, 74, 77, 444, .. etc. Given a string constructed by 4, 7 digit only, find position of this number in this series.

Input:
The first line consists of an integer T i.e number of test cases. The first and only line of each test case consists of a string s

Output:
Print the required output.

Constraints: 
1<=T<=100
1<=|Length of s|<=50

Example:
Input:

2
7
444

Output:
2
7

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

Find the position

Output Window