All Submissions


Problem Specification:

Mr. X owns a factory which prints wedding cards. But the names in the database got mixed up. On each card one of the names (either the brides or the grooms) was wrong.
For example, if the card was supposed to read "Simi weds Raj" it read "Simi weds Karan". Mr. X has to fix this. It costs Rs. 2 to change one letter to another letter, to delete a letter, or to add a letter. Also there are n cards reading the same wrong name (if Simi and Raj ordered 200 cards, there would be 200 cards saying "Simi weds Karan" - all of them need to be changed).

But some people may have unusually long names. One card even read "Neelum weds Krishna Murthy Gopalan Raghava" !
You need to calculate the minimum amount that can be spent to fix all the cards.

Input Specification:

The first line of the input contains t, the number of test cases.

Each test case takes three lines of input, the first containing the number of cards printed for that couple, n; the second with the name present on the card (which should not be) and the third with the name that should be present on the card.

Output Specification:

For each test case there will be one line of output containing the minimum amount that can be spent in fixing the cards (amount should be in rupees).

Sample Input:


4
100
Karan
Raj
150
Pooja
Seema
400
Varad
Ankit
200
Jennifer Aniston
Angelina


Sample Output:


Rs. 800
Rs. 1200
Rs. 4000
Rs. 5200


Note : Lowercase and Uppercase letters are distinct. Maximum length of a name is 200. Also, names can include spaces, separating parts of the name. Maximum number of cards printed in one test case is 2.5 x 10^6. (all values will fit into int data type). Also, space must also be counted as a character (It's a wedding card, it must be perfect).

Problem Setter : Neesha Sinha

Languages: C,C++,Java

Time Limit: 3 Second(s)
Score: 100 Point(s)
Input File Limit: 50000 Bytes

Submit

Login to post clarification.

No Clarifications.

Contest

Mode Judge

Passive

Online

Overall Rankings

RankNameScore
1xyz0
2Ams0
3TIP0
4team420
5xyzz0
6asdasdasd0
7abcd0
8khankhan0
9Gabriel0
10gigel0