maneuver, one can choose any single digit and eliminate it (for example one chooses some situation in the number and eliminates the digit situated at this position). The activity can't be performed if by some stroke of good luck one digit remains. In the event that the subsequent number contains driving zeroes, they are naturally taken out. For example on the off chance that one eliminates from the number 32925 the 3-rd digit, the subsequent number will be 3225. On the off chance that one eliminates from the number 20099050

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter10: Classes And Data Abstraction
Section: Chapter Questions
Problem 19PE
icon
Related questions
Question

Please do in python. Correct answer will upvoted else downvoted 

 

It is given a positive integer n. In 1 maneuver, one can choose any single digit and eliminate it (for example one chooses some situation in the number and eliminates the digit situated at this position). The activity can't be performed if by some stroke of good luck one digit remains. In the event that the subsequent number contains driving zeroes, they are naturally taken out. For example on the off chance that one eliminates from the number 32925 the 3-rd digit, the subsequent number will be 3225. On the off chance that one eliminates from the number 20099050 the primary digit, the subsequent number will be 99050 (the 2 zeroes going close to the main digit are naturally taken out). 

What is the base number of steps to get a number with the end goal that it is distinct by 25 and positive? It is ensured that, for every n happening in the input, the appropriate response exists. It is ensured that the number n has no driving zeros. 

Input :The main line contains one integer t (1≤t≤104) — the number of experiments. Then, at that point, t experiments follow. 

Each experiment comprises of one line containing one integer n (25≤n≤1018). It is ensured that, for every n happening in the input, the appropriate response exists. It is ensured that the number n has no driving zeros. 

Output :For each experiment output on a different line an integer k (k≥0) — the base number of steps to get a number with the end goal that it is separable by 25 and positive.

Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr