Easy Beginners Problems > Ad-hoc

Lacebook, a social network, has recently changed their policy. From now on, a user can not remove any friend from his friend-list. But they have forgotten, that is to remove the remove button. In Lacebook, the friend-list of a user is represented as a list. Each friend is an item of the list. Each item has a corresponding “remove” button. Whenever a user click on that button, the item is removed from the list and then added at the end of the list. Thus the items of the list remain unchanged, only the the changes. Now, you are given two friend-lists containing same items. But the order of the items may vary. Can you make the first list look exactly like the second one using only the remove buttons? Input: ------ Input starts with a positive integer **T(<= 100)**, denoting the number of test cases. The first line of a test case contains a positive integer **N(<= 10000)**, denoting the number of item in a list. Then there will be two lines. The first of the two lines will contain N positive integers denoting the first list. And the second line will also contain N positive integers denoting the second list. A list will always contain unique items. No list will be empty. Output: ------- For each case, print the case number and the minimum number of click required to convert the first list into the second one Sample Input ------------ 2 1 1 1 3 1 2 3 3 2 1 Sample Output ------------- Case 1: 0 Case 2: 2

(Account Deleted)