1000A.md (2411B)
1 Source: https://codeforces.com/problemset/problem/1000/A 2 3 A. Codehorses T-shirts 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners. 22 23 The valid sizes of T-shirts are either "M" or from $0$ to $3$ "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are not. 24 25 There are $n$ winners to the cup for both the previous year and the current year. Ksenia has a list with the T-shirt sizes printed for the last year cup and is yet to send the new list to the printing office. 26 27 Organizers want to distribute the prizes as soon as possible, so now Ksenia is required not to write the whole list from the scratch but just make some changes to the list of the previous year. In one second she can choose arbitrary position in any word and replace its character with some uppercase Latin letter. Ksenia can't remove or add letters in any of the words. 28 29 What is the minimal number of seconds Ksenia is required to spend to change the last year list to the current one? 30 31 The lists are unordered. That means, two lists are considered equal if and only if the number of occurrences of any string is the same in both lists. 32 33 Input 34 35 The first line contains one integer $n$ ($1 \le n \le 100$) — the number of T-shirts. 36 37 The $i$-th of the next $n$ lines contains $a_i$ — the size of the $i$-th T-shirt of the list for the previous year. 38 39 The $i$-th of the next $n$ lines contains $b_i$ — the size of the $i$-th T-shirt of the list for the current year. 40 41 It is guaranteed that all the sizes in the input are valid. It is also guaranteed that Ksenia can produce list $b$ from the list $a$. 42 43 Output 44 45 Print the minimal number of seconds Ksenia is required to spend to change the last year list to the current one. If the lists are already equal, print 0. 46 47 Examples 48 49 Input 50 51 ``` 52 3 53 XS 54 XS 55 M 56 XL 57 S 58 XS 59 ``` 60 61 Output 62 63 ``` 64 2 65 ``` 66 67 Input 68 69 ``` 70 2 71 XXXL 72 XXL 73 XXL 74 XXXS 75 ``` 76 77 Output 78 79 ``` 80 1 81 ``` 82 83 Input 84 85 ``` 86 2 87 M 88 XS 89 XS 90 M 91 ``` 92 93 Output 94 95 ``` 96 0 97 ``` 98 99 Note 100 101 In the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L". 102 103 In the second example Ksenia should replace "L" in "XXXL" with "S". 104 105 In the third example lists are equal.