A. Codehorses T-shirts(水题)

A. Codehorses T-shirts
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.

The valid sizes of T-shirts are either "M" or from 00 to 33 "X" followed by "S" or "L". For example, sizes "M""XXS""L""XXXL" are valid and "XM""Z""XXXXL" are not.

There are nn 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.

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.

What is the minimal number of seconds Ksenia is required to spend to change the last year list to the current one?

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.

Input

The first line contains one integer nn (1n1001≤n≤100) — the number of T-shirts.

The ii-th of the next nn lines contains aiai — the size of the ii-th T-shirt of the list for the previous year.

The ii-th of the next nn lines contains bibi — the size of the ii-th T-shirt of the list for the current year.

It is guaranteed that all the sizes in the input are valid. It is also guaranteed that Ksenia can produce list bb from the list aa.

Output

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.

Examples
input
Copy
3
XS
XS
M
XL
S
XS
output
Copy
2
input
Copy
2
XXXL
XXL
XXL
XXXS
output
Copy
1
input
Copy
2
M
XS
XS
M
output
Copy
0
Note

In the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L".

In the second example Ksenia should replace "L" in "XXXL" with "S".

In the third example lists are equal.


题意:有n个人,给出每个人的衣服的尺码,现在,将这些衣服的尺码换成另外的n种尺码,如果尺码一样的衣服,则不需要换,问,最少需要更换几件衣服。


思路:map记录一下每种尺码的衣服出现的次数,然后一一比较一下就可以了(代码比较丑emm)

#include "iostream"
#include "string"
#include "map"
using namespace std;
map<string,int> mp1,mp2;
int main()
{
    mp1.clear();
    mp2.clear();
    int n,ans=0;
    string s[105];
    string str;
    cin>>n;
    for(int i=0;i;i++) {cin>>s[i];mp1[s[i]]++;}
    for(int i=0;i;i++) {cin>>str;if(!mp1[str]) ans++;else mp2[str]++;}
    for(int i=0;i;i++) if(mp2[s[i]]-mp1[s[i]]>0) ans+=mp2[s[i]]-mp1[s[i]],mp2[s[i]]=-1;
    cout<<ans<<endl;
    return 0;
}




你可能感兴趣的:(水题)