Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C, build a program that : Given a deck of cards, determine the longest ascending sequence and the longest same-suit sequence present in the

Using C, build a program that : Given a deck of cards, determine the longest ascending sequence and the longest same-suit sequence present in the deck. The Input: The first line of input will contain a single positive integer, n, representing the number of input cases. The input cases will follow. Each input case will consist of two lines with 26 cards per line. Each card will be represented by a two-character string: the value followed by the suit. Values will be the characters A for ace, 2-9 for two through nine, T for ten, J for jack, Q for queen K for king. Suits will be S for spades, D for diamonds, H for hearts, and C for clubs. The Output: For each input case, on a line by itself, output the length of the longest same-suit sequence, followed by a space, followed by the length of the longest ascending sequence. Sample Input: 2 2S5SKS3SAS9CTDJCQSKHAC2D2H3H4H5H6HQD9SJD8HAH4D7CJS8C KD5C2CQHTS9H5DJHQC4C8D7STHAD7H6D6C6S9D4S7DKC3D8S3CTC QCTD4C8D7STHAD7H2D3S6D6C6S9D4SAS7D2HKC5H3DTC8S9C3H3C QD9SQSJD8HAH2SKS4D4H5S7CJS8CKD5C2CACQHJCTS6HKH9H5DJH Sample Output: 5 7 3 2

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

More Books

Students also viewed these Databases questions