SP18283 IITWPC4H - Maggu and Cuteness of Strings

Description

**Given two strings s and t of size n and m respectively. You can construct a string w of size n+m using s and t such that it should contain both s and t as its subsequences.** String w must satisfy this condition: For each character from 'a' to 'z', count of the character in w should be equal to sum of count in s and t. Additionally every character of w must belong to the subsequence for either s or t. **eg. if s = ab and t = cd, Then w can be abcd, acbd, cdab, cabd, acdb, cadb. Note that adcb is not correct, As t is not a subsequence in it.** **“Cuteness value” of a string is defined as the maximum length of consecutive equal characters in the string.** **For all possible string w that you can construct, find out the maximum value of “Cuteness value”.**

Input Format

N/A

Output Format

For each test case, output the answer as given in problem statement.