#C5424. Minimum Card Exchanges

    ID: 49072 Type: Default 1000ms 256MiB

Minimum Card Exchanges

Minimum Card Exchanges

Alice and Bob each have a collection of cards. Each card is represented by a lowercase letter, and a collection is represented as a string. They want to exchange cards so that both have at least one card from each distinct set (i.e. each unique letter).

Formally, let \( A \) be the set of characters in Alice's string and \( B \) be the set of characters in Bob's string. They need to exchange cards so that each of them gets every type of card present in either collection. The minimum number of exchanges required is given by:

[ E = |A \setminus B| + |B \setminus A| ]

For example, if Alice's cards are "aabcc" and Bob's cards are "dbbb", then Alice has \({a, b, c}\) and Bob has \({d, b}\). The cards to be exchanged are from sets \({a, c}\) from Alice and \({d}\) from Bob, making a total of 3 exchanges.

inputFormat

The input consists of two lines. The first line contains a string representing Alice's cards, and the second line contains a string representing Bob's cards. Both strings may be empty, and the characters in the string are lowercase letters.

outputFormat

Output a single integer representing the minimum number of cards that need to be exchanged.

## sample
aabcc
dbbb
3