Company: exxonmobil_5sep
Difficulty: medium
Equal Sum Halves Substring Problem Description You are given a string s of length n . The string s consists of digits varying from 0-9. Find and print the length of the longest even length substring s' , such that the length of the substring is 2k digits and the sum of left k digits is equal to the sum of right k digits. Note: Print 0 if no such substring is possible with the given condition. Input Format The input consists of two lines: The first line contains an integer denoting n . The second line contains a string denoting s . Input will be read from the STDIN by the candidate Output Format Print the length of the longest even length substring. The output will be matched to the candidate's output printed on the STDOUT Constraints 1 <= n <= 10^3 0 <= s_i <= 9 (where s_i is a digit in string s ) Examples Example 1: Input: 7 1241424 Output: 6 Explanation: s : 1241424. Longest even length substring with equal sum when divided into half : 124142. Sum of first half digits (12