Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem statement ( you should use only iostream and string header files. ) You are given a string consisting of English uppercase and lowercase letters

Problem statement(you should use only iostream and string header files.)
You are given a string consisting of English uppercase and lowercase letters and decimal
numbers. You can create a strictly increasing sequence (SIS) by picking each letter from
the beginning of this string one by one. And this sequence consists of the numbers 0 to 9,
lowercase English letters a to z, and uppercase English letters A to Z in order. If you receive
2648 as input, SIS can be satisfied with just single-digit strings like {2},{4},{6},{8}. And
it also satisfied with two-digit strings like {2,6},{2,4},{2,8},{6,8}, and three-digit strings
like {2,6,8},{2,4,8}. However, strings like {2,6,4,8} cannot satisfy SIS because 4 is less
than 6.
1
Your goal is to find the length of the longest string that satisfies SIS for a given string.
In the case above, your code should print 3 because the longest string that satisfies SIS is 3
characters long. For example, if you receive 1234abcABC as input, all strings will increase
in order from the beginning, and the result should be 10.
Note that consecutive numbers or letters are considered one sequence. For example, input like 00001
should be calculated as {0,1} and printed 2. Even if the result is the same,
there may be various cases that satisfy the longest SIS. The maximum value of the result
that can be printed will be 09(10)+ a z(26)+ A Z(26)=62.
Students can use recursion function in this problem. A recursive function is a function
that solves a problem by calling itself. Functions break a problem into smaller problems and
solve those smaller problems in the same way. This process is repeated until the simplest
form of the problem, i.e. the base case, is reached. The following code is a function that
calculates the factorial with recursive function.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learning PostgreSQL

Authors: Salahaldin Juba, Achim Vannahme, Andrey Volkov

1st Edition

178398919X, 9781783989195

More Books

Students also viewed these Databases questions

Question

Explain pre-employment screening and background checks.

Answered: 1 week ago

Question

3. Put a rotating monitor in charge of equipment or materials.

Answered: 1 week ago

Question

Q: The value of (tan 1 tan 2 tan 3 tan 89) is

Answered: 1 week ago

Question

Explain the different ways to turn on an SCR.

Answered: 1 week ago

Question

How are values illustrated in the case?

Answered: 1 week ago

Question

Describe S. Truett Cathys self-concept and self-efficacy.

Answered: 1 week ago