#C8706. Final String Lengths after Removing Common Characters
Final String Lengths after Removing Common Characters
Final String Lengths after Removing Common Characters
You are given two strings s and t. For each character that appears in both strings, you must remove it from both strings exactly as many times as the minimum number of occurrences in either string. In other words, for every character \(c\) that appears in both s and t, if it appears \(m\) times in s and \(n\) times in t, remove \(\min(m, n)\) occurrences from each string.
Your task is to determine the lengths of the strings after all such removals have been carried out.
Example: If s = "abc" and t = "bca", then all common characters are removed, leaving both strings empty, so the answer is (0, 0).
inputFormat
The input consists of two lines. The first line contains the string s and the second line contains the string t.
outputFormat
Output two integers separated by a space representing the final lengths of s and t after removing the common characters.
## sampleabc
bca
0 0