#K94957. Unique Gears Count

    ID: 38756 Type: Default 1000ms 256MiB

Unique Gears Count

Unique Gears Count

You are given two strings that represent the arrangement of gears on two clocks. Each character in the string represents a gear. Your task is to determine the total number of unique gears when the two sets are combined.

More formally, let \(A\) be the set of gears (characters) in the first clock string and \(B\) be the set in the second clock string. You need to output the size of the union \(A \cup B\), i.e.,

\(\text{answer} = |A \cup B|\)

An empty string represents a clock with no gears.

inputFormat

The input is read from standard input (stdin) and has the following format:

  • The first line contains an integer \(T\) representing the number of test cases.
  • Each test case consists of two lines. The first line is the first clock string and the second line is the second clock string. Note that a clock string may be empty.

outputFormat

For each test case, print a single line to standard output (stdout) containing the number of unique gears, which is the size of the union of characters from the two input strings.

## sample
5
abc
bcd
xyz
yz
aaa
aaa
abc
xyz

abc
4

3 1 6 3

</p>