Given a string S, find the longest subarray that c ontains only the uppercase letter. If no uppercas e letter is present in the string, print 0. Note String only contains lowercase and uppercase let ters. There will be multiple test cases running so the I nput and Output should match exactly as provid ed. The base Output variable result is set to a default value of -404 which can be modified. Additionall y, you can add or remove these output variables. Input Format The first line of input contains the string S. Sample Input abcdeABCD --denotes S Constraints 0<= S.length() <=1000 Output Format The output contains a single integer denoting th e length of the longest subarray which contains only uppercase letters. Sample Output 4 Explanation ABCD is a subarray that has a length of 4 and c ontains all the uppercase letters only Hence, the answer is 4.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter7: Characters, Strings, And The Stringbuilder
Section: Chapter Questions
Problem 19RQ
icon
Related questions
Question
Use python fast 15 minutes
Given a string S, find the longest subarray that c
ontains only the uppercase letter. If no uppercas
e letter is present in the string, print 0.
Note
String only contains lowercase and uppercase let
ters.
There will be multiple test cases running so the I
nput and Output should match exactly as provid
ed.
The base Output variable result is set to a default -
value of -404 which can be modified. Additionall
y, you can add or remove these output variables.
Input Format
The first line of input contains the string S.
Sample Input
abcdeABCD
Constraints
0<= S.length() <=1000
--denotes S
Output Format
The output contains a single integer denoting th
e length of the longest subarray which contains
only uppercase letters.
Sample Output
4
Explanation
ABCD is a subarray that has a length of 4 and c
ontains all the uppercase letters only
Hence, the answer is 4.
Transcribed Image Text:Given a string S, find the longest subarray that c ontains only the uppercase letter. If no uppercas e letter is present in the string, print 0. Note String only contains lowercase and uppercase let ters. There will be multiple test cases running so the I nput and Output should match exactly as provid ed. The base Output variable result is set to a default - value of -404 which can be modified. Additionall y, you can add or remove these output variables. Input Format The first line of input contains the string S. Sample Input abcdeABCD Constraints 0<= S.length() <=1000 --denotes S Output Format The output contains a single integer denoting th e length of the longest subarray which contains only uppercase letters. Sample Output 4 Explanation ABCD is a subarray that has a length of 4 and c ontains all the uppercase letters only Hence, the answer is 4.
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Function Arguments
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
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT