Othello Rearrangement

Given two length-N strings of W and B, find the minimum number of swap-two-positions and flip-one-piece operations to turn the start into the target.

Medium5GreedyMathStringNo attempts yetTime limit2sMemory limit256 MB

Problem

Sehee likes robots. In her robotics club she built one out of a camera, sensors, a Raspberry Pi, and a gripper, and she uses it for a task called Othello rearrangement. An Othello piece is black on one face and white on the other. Sehee wants the pieces that lie on the board at the start to end up exactly like a given target arrangement.

The robot can perform one of the two operations below, one at a time.

  1. Pick any two pieces on the board and swap their positions.
  2. Pick up one piece, turn it over, and put it back, which changes its color.
StartTarget
WBBWWWBWBW

For the arrangement above, turning over the third piece and the fourth piece reaches the target in two operations. Swapping the third piece with the fourth piece instead reaches the target in one operation.

Given the starting arrangement and the target arrangement, write a program that finds the minimum number of operations needed to reach the target arrangement.

Input

Input is read from standard input. The first line contains the number of test data TT. The first line of each test data contains the number of Othello pieces NN (1N1000001 \le N \le 100000). The second line holds the starting arrangement and the third line holds the target arrangement, each a string of length NN. A piece showing its white face is written as W, and a piece showing its black face is written as B.

Output

Output is written to standard output. For each test data, print on one line the minimum number of operations that turns the starting arrangement into the target arrangement.