Codeforces-1000A Codehorses T-shirts

 

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 0 to 3 "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 (1n100) — the number of T-shirts.

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

The i-th of the next nn lines contains bibi — the size of the i-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
3
XS
XS
M
XL
S
XS
Output
2
Input
2
XXXL
XXL
XXL
XXXS
Output
1
Input
2
M
XS
XS
M
Output
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件以前T-shirt,不同型号。

现在分给新的n个人,需求不同,同型号的人可以用以前的,问需要新买多少件。

代码:STL大法好!!!

MAP记录型号的个数即可,最后为负数的就是缺的件数,加起来就行

#include<bits/stdc++.h>
using namespace std;
map<string,int> test;
int main()
{
  int n=0;
  cin>>n;
  string temp;
  for(int i=1;i<=n;i++)
  {
    cin>>temp;
    test[temp]++;
  }
  for(int i=1;i<=n;i++)
  {
    cin>>temp;
    test[temp]--;
  }
  long long int ans=0;
  for(map<string,int>::iterator i=test.begin();i!=test.end();i++)
  {
    if(i->second<0)
      ans+=abs(i->second);
  }
  cout<<ans<<endl;
}

 

 

点赞

发表评论

电子邮件地址不会被公开。必填项已用 * 标注

2 × 5 =