Longest String  You are given S consisting of only 0 and 1 An integer X Input: The first line contains an integer T denoting the number of the test cases. For each test case , first line contains a string S. The secind line contains an integer X Output. For each test case print an integer number in a new line representing the legth of the longest subsequences of string S. Sample input: 1 111011100 100 Sample output: 7

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 21PE
icon
Related questions
icon
Concept explainers
Question

Longest String 

You are given S consisting of only 0 and 1

An integer X

Input: The first line contains an integer T denoting the number of the test cases.

For each test case , first line contains a string S.

The secind line contains an integer X

Output. For each test case print an integer number in a new line representing the legth of the longest subsequences of string S.

Sample input:

1

111011100

100

Sample output:

7

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Control Structure
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning