Company: Publicis Sapient
Difficulty: medium
Maximal TextScore Substring Problem Description Complete the function calculateScore in the editor below. The function must return a string that denotes the non-empty substring of text having a maximal textScore . If there are multiple such substrings, choose the lexicographically smallest substring. For each non-empty substring sub of text , the textScore is calculated as follows: prefixScore: The length of the longest prefix of sub that is also a suffix of prefixString . suffixScore: The length of the longest suffix of sub that is also a prefix of suffixString . textScore: prefixScore + suffixScore . The function calculateScore has the following parameter(s): text : a string prefixString : a string suffixString : a string Input Format for Custom Testing: Input from stdin will be processed as follows and passed to the function. The first line contains a string text . The next line contains a string prefixString . The last line contains a string suffixString . Examples Example 1: Input