Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ or Java Complete the function firstRepeatingLetter in your editor. I has parameter: 1. A string. t must retum the first repeating letter in a
C++ or Java
Complete the function firstRepeatingLetter in your editor. I has parameter: 1. A string. t must retum the first repeating letter in a stning l.e. the character which occurs more than once in a given stringl Note: Treat the string as case sensitive, so'a' and'A' are different characters for the purposes of finding repetitions. If multiple characters recur, pick the one whose first occurrence is sooner, not the one whose second occurrence is soone Input Format The locked stub code in your cditor reads the following input from stdin and passes it to your function The first line contains a single strings Constraints String consists of alphabet lelters in uppercase and vcasA-7anci a- It is guaranteed that at least one letter will appear at more thari one places at least r Output Format our function must return the first repeating letter in a string ue. the character which occurs more than once in a given string. This is printed to stdout by the locked stub code in your editor. Sample Input 1 bt ba Sample Output 1 Explanation yi ocour oth aand 'b'ocour twic co. Since tho first occurranco of ais bafare the first occurranca of 'b, ais the araworStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started