String Clash

2.6

7 votes
Basic Programming, Basics of Implementation, Easy, Hash Maps, Implementation, String Manipulation
Problem

You are given two strings S and T of equal lengths. You need to pick some characters from the first string, some from the second string and then form a new string by rearranging the characters you have picked. You need to find the length of the maximum string that you can make which will be a palindrome.

Input

The first line contains a string S as input and the next line contains a string T as input.

Output

In the output, you need to print an integer which denotes the maximum length of the palindrome that can be obtained.

Constraints

1|S|,|T|1000

Sample Input
aab
cba
Sample Output
5
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

In the sample test case, you can form the string baaab by picking the characters from both the strings.

Editor Image

?