Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem statement ( you should use only #include, #include You are given a string consisting of English uppercase and lowercase letters and decimal numbers. You

Problem statement (you should use only #include, #include
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

Systems Analysis And Synthesis Bridging Computer Science And Information Technology

Authors: Barry Dwyer

1st Edition

0128054492, 9780128054499

More Books

Students also viewed these Databases questions

Question

Compute and interpret the inventory turnover. AppendixLO1

Answered: 1 week ago

Question

11.1 Explain the strategic importance of total rewards.

Answered: 1 week ago

Question

11.3 Define pay equity and explain its importance today.

Answered: 1 week ago