Answer in C++ Only: Mother is the most loved person. She wants to surprise his son on his birthday so she prepares a birthday cake for one of his Child, and decides to write the child's age by candlelight on the cake. There are 10 types of candles, one for each digit '0' to '9 '. The mom has forgotten the child's age, however, so he doesn't know he has enough candles of the right kind. For example, if the child was 101 years old, the cook would need two '1' candles and one '0' candle. With the supply of candles, the chef has, your job is to find the most complete amount that can be represented by those candles. Input 1 2114063222 Output: 4

icon
Related questions
Question

F4

Answer in C++ Only:
Mother is the most loved person. She wants to surprise his son on his birthday so she prepares a
birthday cake for one of his Child, and decides to write the child's age by candlelight on the cake.
There are 10 types of candles, one for each digit '0' to '9 '. The mom has forgotten the child's age,
however, so he doesn't know he has enough candles of the right kind. For example, if the child was
101 years old, the cook would need two '1' candles and one '0' candle. With the supply of candles,
the chef has, your job is to find the most complete amount that can be represented by those
candles.
Input
1
2114063222
Output:
4
Transcribed Image Text:Answer in C++ Only: Mother is the most loved person. She wants to surprise his son on his birthday so she prepares a birthday cake for one of his Child, and decides to write the child's age by candlelight on the cake. There are 10 types of candles, one for each digit '0' to '9 '. The mom has forgotten the child's age, however, so he doesn't know he has enough candles of the right kind. For example, if the child was 101 years old, the cook would need two '1' candles and one '0' candle. With the supply of candles, the chef has, your job is to find the most complete amount that can be represented by those candles. Input 1 2114063222 Output: 4
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer