Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Like Old Times Again

By flash_7 · Limits 2s, 1.0 GB

Do you remember Lee? He was the only superhuman having the superpower of time traveling. A few years back while traveling to the past Lee got trapped in time and lost control over his power. Fortunately there lived a magician named Stan during that time. Lee was very desperate to get his superpower back and so he went to the magician for help. Stan couldn’t refuse him. He gave him an old-time Nokia Phone and all Lee had to do is type “marvel” to escape from that misery.

Years have been passed and Lee is also dead. Scientists are doing some research on the life history of Lee. While searching his home, they have now found that old-time Nokia phone as well as a letter where that mysterious story of Lee escaping from that trap is written! Now the scientists are wondering, how many times Lee had to press the buttons to type that mysterious word “marvel” which helped him to regain his power.

You know, the modern scientists are too dumb, they have no idea about the keypad of the old-time Nokia phones. So you have got to help them by finding the answer they are searching. If you have forgotten, the old-time Nokia phone keypad looks exactly like the image below.

To type any character you might have to press the corresponding button multiple times. For example, if you want to type a, then you can press the button 2 just once. But if you want to type c, you have to press the button 2 three times. So if you want to type the word “nsu”, you have to press 6 two times, 7 four times and 8 two times. Which is in total (2+2+4) = 8. Now you have to find how many times Lee pressed the buttons to type the word “marvel”.


There’s no input in this problem.


Print a single integer, the number of times Lee pressed the buttons to type the word “marvel”.

The output is incorrect. It has been given in the sample output just to show you the correct procedure. You have to print the correct answer.



    97% Solution Ratio

    Md.MehediEarliest, Dec '18

    Md.MehediFastest, 0.0s

    fsshakkhorLightest, 0 B

    touhidurShortest, 2B


    Login to submit

    Related Contests

    Intra NSU Programming Contest Fall 2018 Ended at 2018-11-23 07:20:00 +0000 UTC
    Replay of Intra NSU Programming Contest Fall 2018 Ended at 2018-12-07 17:00:00 +0000 UTC
    Inter University Girls' Programming Contest Season 2 Mock Ended at 2019-07-18 16:00:00 +0000 UTC