~/algor $ cat problems/string-umumiy-harflar
Number of common letters
Easy
1000 ms
128 MB
30%
Two words $a$ and $b$ of lowercase Latin letters are given. For every letter take the smaller of its counts in $a$ and in $b$. Find the sum of these numbers over all letters.
Input
The first line contains $a$, the second line $b$.
Output
One integer.
Note
$1 \le |a|, |b| \le 10^{5}$
$a$ and $b$ consist of lowercase Latin letters only
Examples
Input #1
banana ananas
Output #1
5
Input #2
abc xyz
Output #2
0