#C5892. Minimum Deletions to Make Anagrams

    ID: 49591 Type: Default 1000ms 256MiB

Minimum Deletions to Make Anagrams

Minimum Deletions to Make Anagrams

Given two strings s1 and s2, determine the minimum number of character deletions required from both strings so that they become anagrams of each other. Two strings are anagrams if the frequency of every character in both strings is the same.

You can formalize the answer using the formula below:

$$\text{deletions} = \sum_{c}\left|\text{count}_{s1}(c)-\text{count}_{s2}(c)\right|$$

The input consists of two lines. The first line contains the string s1 and the second line contains the string s2. The output is a single integer that represents the minimum number of deletions required.

inputFormat

The input is read from standard input (stdin) and consists of two lines:

  1. The first line contains the string s1.
  2. The second line contains the string s2.

outputFormat

Output a single integer to standard output (stdout), which is the minimum number of character deletions required to make the two strings anagrams of each other.

## sample
abc
cde
4