#K41352. Minimum Moves to Make Anagram

    ID: 26846 Type: Default 1000ms 256MiB

Minimum Moves to Make Anagram

Minimum Moves to Make Anagram

Given two strings s1 and s2 of equal length, your task is to transform s2 into an anagram of s1 using the minimum number of moves. In one move, you can change any character in s2 into any other character. Two strings are anagrams if they contain the same characters with identical frequencies.

The minimum number of moves can be computed using the formula: $$moves = \frac{1}{2}\sum_{c \in \Sigma} \left|freq(s1, c) - freq(s2, c)\right|$$, where \(\Sigma\) denotes the set of all characters.

inputFormat

The first line contains a single integer T denoting the number of test cases. Each of the following T lines contains two space-separated strings s1 and s2.

outputFormat

For each test case, output on a new line a single integer representing the minimum number of moves required to convert s2 into an anagram of s1.

## sample
3
aba baa
abc bca
abc def
0

0 3

</p>