The method longeststreak is intended to determine the longest substring of consecutive identical characters in the parameter str and print the result. For example, the call longeststreak(“ccttt!”) should print the result “a 5” because the longest substring of consecutive identical characters is “”. Complete the method below. Your implementation should conform to the example above.
Please indicate your views on the correct answer to question. Each of your comments will be evaluated by our moderators and correct answers will be shared.