Time Limit: 2 Seconds
Memory Limit: 65536 KB
Sunny Cup 2003 - Preliminary Round
April 20th, 12:00 - 17:00
Problem A: Careless Tony
Tony is such a careless typist that he finds himself making mistakes AGAIN.
What's worse, the cursor key is not working so that he can only use the backspace
key to reach the place where the mistake is, and then type whatever he's deleted
on the way AGAIN :(
Now let's help Tony find out at least how long it will cost him to correct his
The first line of input contains an integer N, which is the number of test
cases. Then N test cases follow.
Each test case consists of 3 lines of input:
the 1st line contains a positive integer t (<= 100), which is the time taken
for Tony to delete/input a character;
the 2nd line contains the correct content of text;
and the 3rd line contains the text typed by Tony.
Note: The text contents contain only the readable characters. The total length
of each text is no longer than 80 characters.
For each test case, print in one line the minimal time taken for Tony to correct
Author: XU, Chuan
Source: Zhejiang University Local Contest 2003, Preliminary