Question: 1 . Palindromes in a String You are given a string, str . You need to find the score of stras per the following rules:

1. Palindromes in a String You are given a string, str. You need to find the score of stras per the following rules: 11 For each palindrome of length 4 in str, add 5 to the score 2) For each palindrome of length 5 in str, add 10 to the score It is given that palindromes can.overlap within str. However, the characters of the palindrome must be continuous and must NOT be circular (i.e. they must NOT wrap around the end of the string Output the final value of score. Notes: A palindrome is a word, phrase, or sequence that reads the same backwards as forwards. Examples of palindromes are words like "madam", "racecar", "abCba" and "aBccBa", and "ABBA" Palindromes are case-sensitive in this problem (e.g. "Madam" and "ABCcba" are NOT palindromes) The score is initially 0 There are no whitespaces in str. Answered str Function description Complete the scoreString function in the editor below. It has the following parameter(s): Name Type STRING Description The string you are given

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!