jiahuimbzuai/CoQuIR huggingface dataset:
//  [typescript]
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8').trim()

const [a, b, c, d] = stdin
  .split('\n')[0]
  .split(' ')
  .map(Number)

const ans = () => {
  const aCount = getCount(a - 1)
  const bCount = getCount(b)

  return bCount - aCount
}

const getCount = num => {
  const cmul = Math.floor(num / c)
  const dmul = Math.floor(num / d)

  const l = lcm(c, d)
  const dups = Math.floor(num / l)

  return num - cmul - dmul + dups
}

const lcm = (a,b) => {
  const g = (n, m) => m ? g(m, n % m) : n
  return a * b / g(a, b)
}

const gcd = (a, b) => {
  if (b === 0){
      return a
  }
  return gcd(b, a % b)
}

console.log(ans())
//  [typescript]
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8').trim()

const [a, b, c, d] = stdin
  .split('\n')[0]
  .split(' ')
  .map(Number)

const s = new Set()

const ans = () => {
  if (c === 1 || d === 1) {
    return 0
  }

  const cs = getCount(c)
  const ds = getCount(d)
  const cds = getCount(c * d)

  const divs = cs + ds - cds

  return b - a + 1 - divs
}

const getCount = n => {
  let i = 1

  let count = 0
  while (1) {
    const num = i * n

    if (a <= num && num <= b && !s.has(num)) {
      s.add(num)
      count++
    } else if (b < num) {
      return count
    }

    i++
  }
}

console.log(ans())
//  [python]
def main():
    n = int(input())
    ss = [input() for _ in range(n)]
    m = int(input())
    ts = [input() for _ in range(m)]

    fruits = list(set(ss))
    ans = 0
    for fruit in fruits:
        money = 0
        money += ss.count(fruit)
        money -= ts.count(fruit)
        ans = max(ans, money)
    print(ans)


if __name__ == "__main__":
    main()
//  [python]
N = int(input())
red = {}
for i in range(N):
    tmp = input()
    if tmp in red:
        red[tmp] += 1
    else:
        red[tmp] = 1

M = int(input())
for i in range(M):
    tmp = input()
    if tmp in red:
        red[tmp] -= 1

print(max(0,max(red.values())))
//  [python]
N=int(input())
s=[]
for i in range(N):
    s+=[input()]
M=int(input())
t=[]
for i in range(M):
    t+=[input()]
ans1=0
ss=list(set(s))
for i in range(len(set(s))):
    ans=s.count(ss[i])-t.count(ss[i])
    ans1=max(ans1,ans)
if ans1<0:
    print(0)
    exit()
print(ans1)
//  [python]
n = [input() for _ in range(int(input()))]
m = [input() for _ in range(int(input()))]
l = list(set(n))
print(max(0,max(n.count(l[i])-m.count(l[i])))  for i in range(len(l)))
//  [python]
N = int(input())
blue_cards = [input() for _ in range(N)]
M = int(input())
red_cards = [input() for _ in range(M)]
ans = 0

for i in blue_cards:
    a = blue_cards.count(i)
    b = red_cards.count(i)
    ans = a - b

if ans > 0:
    print(ans)
else:
    print(0)
//  [python]
N = int(input())
C = {}
for _ in range(N):
    a = input().strip()
    if a not in C:
        C[a] = 0
    C[a] += 1
M = int(input())
for _ in range(M):
    a = input().strip()
    if a not in C:
        C[a] = 0
    C[a] -= 1
cmax = -100
for a in C:
    cmax = max(cmax,C[a])
print(cmax)
//  [java]

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;

/**
 *
 * @author rn-sshawish
 */
public class Main{

    public static void main(String[] args) throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(input.readLine());
        int count = 0;
        HashMap<String, Integer> blueCard = new HashMap<>();
        HashMap<String, Integer> redCard = new HashMap<>();
        for (int i = 0; i < n; i++) {
            String key = input.readLine();
            blueCard.put(key, blueCard.getOrDefault(key, 0) + 1);
        }
        int m = Integer.parseInt(input.readLine());
        for (int i = 0; i < m; i++) {
            String key = input.readLine();
            redCard.put(key, redCard.getOrDefault(key, 0) + 1);
        }
        for (Map.Entry<String, Integer> entry : blueCard.entrySet()) {
            if (redCard.containsKey(entry.getKey()) && entry.getValue() > redCard.get(entry.getKey())) {
                count = Math.max(entry.getValue() - redCard.get(entry.getKey()), count);
            } else if (!redCard.containsKey(entry.getKey())) {
                count = Math.max(count, entry.getValue());
            }
        }
        System.out.println(count);
    }
}
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		// solver.readHead(in.readLine());
		// for (; solver.hasNext();) {
		// solver.readBody(in.readLine());
		// }
		// solver.solve();
		solver.readN(in.readLine());
		for (; solver.hasNextN();) {
			solver.readBodyN(in.readLine());
		}
		solver.readM(in.readLine());
		for (; solver.hasNextM();) {
			solver.readBodyM(in.readLine());
		}
		solver.solve();
	}
}

class Solver {
	int N;
	int M;
	int cnt;

	public void init() {
		N = 0;
		M = 0;
		cnt = 0;
		Blue = new HashMap<String, Integer>();
		Red = new HashMap<String, Integer>();
	}

	public void readHead(String str) {
		String[] strArr = str.split(" ");
		// N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
	}

	public void readN(String str) {
		N = Integer.parseInt(str);
		cnt = 0;
	}

	public void readM(String str) {
		M = Integer.parseInt(str);
		cnt = 0;
	}

	public boolean hasNextN() {
		return cnt < N;
	}

	public boolean hasNextM() {
		return cnt < M;
	}

	public void readBody(String str) {
		// System.out.println(str);
		cnt++;
	}

	HashMap<String, Integer> Blue;

	public void readBodyN(String str) {
		// System.out.println(str);
		if (Blue.containsKey(str))
			Blue.put(str, Blue.get(str) + 1);
		else
			Blue.put(str, 1);
		cnt++;
	}

	HashMap<String, Integer> Red;

	public void readBodyM(String str) {
		// System.out.println(str);
		if (Red.containsKey(str))
			Red.put(str, Red.get(str) + 1);
		else
			Red.put(str, 1);
		cnt++;
	}

	public void solve() {
		int ans = 0;
		for (String key : Blue.keySet()) {
			int n = Blue.get(key);
			if (Red.containsKey(key))
				n -= Red.get(key);
			if (n > ans)
				ans = n;
		}

		System.out.println(ans);
	}
}
//  [java]
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Map;
import java.util.HashMap;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        
        HashMap<String, Integer> cards = new HashMap<String, Integer>();
        
        for (int i = 0; i < n; i++) {
            String key = br.readLine();
            if (cards.get(key) == null) cards.put(key, 1);
            else cards.put(key, cards.get(key) + 1);
        }
        
        int m = Integer.parseInt(br.readLine());
        
        for (int i = 0; i < m; i++) {
            String key = br.readLine();
            if (cards.get(key) == null) cards.put(key, -1);
            else cards.put(key, cards.get(key) - 1);
        }
        
        int max = 0;
        for (int value : cards.values()) {
            if (max < value) max = value;
        }
        
        System.out.println(max);
    }
}
//  [java]
import java.util.Scanner;
 
public class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    Map<String,Integer> blue = new HashMap<>();
    Map<String,Integer> red = new HashMap<>();
    
    int N = sc.nextInt();
    int M = sc.nextInt();
    
    for(int i = 0; i < N; i++) {
      String s = sc.next();
      if(blue.get(s) == null) {  //値が存在しない場合
        blue.put(s, 1);
      }else {                    //値がすでに存在する場合
        blue.put(s, blue.get(s)+1);
      }
    }
    
    for(int i=0;i<M;i++) {
      String s=sc.next();
      if(red.get(s) == null) {
        red.put(s, 1);
      }else {
        red.put(s, red.get(s)+1);
      }
    }
    
    int max = 0;
    for(String key : blue.keySet()) {
      int now;
      if(red.containsKey(key)) {
        now = blue.get(key) - red.get(key);
      }else {
        now = blue.get(key);
      }
      if(max < now) {
        max = now;
      }
    }
    System.out.println(max>0?max:0);
  }
}
//  [java]
import java.util.HashMap;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int result = 0;
		int N = sc.nextInt();
		HashMap<String,Integer> map = new HashMap<String,Integer>();
		for(int i = 0; i < N; i++) {
			String s = sc.next();
			if(map.containsKey(s)) {
				map.put(s, 1);
			}else {
				map.replace(s, map.get(s) +1);
			}
		}

		int M = sc.nextInt();
		for(int i = 0; i < M; i++) {
			String t = sc.next();
			if(map.containsKey(t)) {
				map.replace(t, map.get(t) -1);
			}
		}

		for(int num : map.values()) {
			result = Math.max(result, num);
		}

		System.out.println(result);
	}
}
//  [cpp]
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<bitset>
#define ld long double
#define ll long long int
#define ull unsigned long long int
#define rep(i,n) for(i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define INF INT_MAX;
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long LLINF=1LL<<60;
//set<int>::iterator it;



int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
	
	map<string,int> m;
	set<string> s;
	string str;
	int i,a,b;
	cin>>a;
	rep(i,a){
		cin>>str;
		if(s.find(str)!=s.end()){
			m[str]++;
		}
		else{
			s.insert(str);
			m[str]=1;
		}
	}
	cin>>b;
	rep(i,b){
		cin>>str;
		if(s.find(str)!=s.end()){
			m[str]--;
		}
	}
	int max=0;
	str="llllllllld";
	map<string,int>::iterator it;
	for(it=m.begin();it!=m.end();it++){
		if(it->second>=max){
			max=it->second;
			str=it->first;
		}
	}
	cout<<max<<endl;
	
	
	
	
//////////////////////////////////////////////////////
	return 0;
}
//  [cpp]
#include <iostream>
#include <string>
using namespace std;
int main(){
    int N, M, max = 0, tmp;
    string s[101], t[101];
    cin >> N;
    for (int i = 0; i < N; i++) cin >> s[i];
    cin >> M;
    for (int i = 0; i < M; i++) cin >> t[i];
    for (int i = 0; i < N; i++) {
        tmp = 0;
        for (int j = 0; j < N; j++)
            if (s[i] == s[j]) tmp++;
        for (int j = 0; j < M; j++)
            if (s[i] == t[j]) tmp--;
        if (tmp > max) max = tmp;
    }
    cout << max << endl;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;


int N, M;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    map<string, int> scount;
    cin >> N;
    for(int i=0; i<N; i++){
        string s;
        cin >> s;
        scount[s]++;
    }
    cin >> M;
    for(int i=0; i<M; i++){
        string t;
        cin >> t;
        scount[t]--;
    }
    int maxs = 1e-2;
    for(auto it=scount.begin(); it != scount.end(); it++){
        if(maxs< (it->second)){
            maxs = it->second;
        }
    }
    cout << maxs << endl;
    return 0;
}
//  [cpp]
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>; 
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){
    int n; cin >> n;
    map<string, int> mp;
    rep(i, n){
        string s; cin >> s;
        mp[s]++;
    }
    int m; cin >> m;
    rep(i, m){
        string s; cin >> s;
        mp[s]--;
    }
    int res = -INF;
    for(auto m: mp){
        int score = m.second;
        chmax(res, score);
    }
    cout << res << ln;
}
//  [cpp]
#include <bits/stdc++.h>
//#include <atcoder/all>
#define rep(i, n) for (int i = 0; i < (n); ++i)
// using namespace atcoder;
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
//マクロ
// forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
// Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
// xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())       // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))    //最大値を求める
#define MIN(x) *min_element(ALL(x))    //最小値を求める
//定数
#define INF 1000000000000  // 10^12:極めて大きい値,∞
#define inf 2147483647     // int値の最大値
#define MOD 1000000007     // 10^9+7:合同式の法
#define MAXR 100000        // 10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back                             // vectorヘの挿入
#define MP make_pair                             // pairのコンストラクタ
#define F first                                  // pairの一つ目の要素
#define S second                                 // pairの二つ目の要素
#define CST(x) cout << fixed << setprecision(x)  //小数点以下の桁数指定
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int gcd(int a, int b) {
    if (b == 0)
        return a;
    else
        return gcd(b, a % b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
//各桁の和
int sumDight(int x) {
    int sum = 0;
    while (x > 0) {
        sum += (x % 10);
        x /= 10;
    }
    return sum;
}
//回文数
int divideReverse(int x) {
    int reverse = 0;
    int r;
    while (x > 0) {
        r = x % 10;
        reverse = reverse * 10 + r;
        x /= 10;
    }
    return reverse;
}

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);

    int n, m;
    cin >> n;
    vector<string> s(110);
    rep(i, n) cin >> s[i];
    cin >> m;
    vector<string> t(110);
   rep(i, m) cin >> t[i];

    map<string, int> a;
    rep(i, n) { a[s[i]] += 1; }
    rep(i, m) a[t[i]] -= 1;
    int ma = -100;
    for (int i = 0; i < (int)a.size(); i++)
        if (ma < a.at(s[i])) ma = a.at(s[i]);

    if(ma>0)cout << ma << endl;
    else
        cout << 0 << endl;
}
//  [cpp]
#include <bits/stdc++.h>
//#include <atcoder/all>
#define rep(i, n) for (int i = 0; i < (n); ++i)
// using namespace atcoder;
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
//マクロ
// forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
// Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
// xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())       // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))    //最大値を求める
#define MIN(x) *min_element(ALL(x))    //最小値を求める
//定数
#define INF 1000000000000  // 10^12:極めて大きい値,∞
#define inf 2147483647     // int値の最大値
#define MOD 1000000007     // 10^9+7:合同式の法
#define MAXR 100000        // 10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back                             // vectorヘの挿入
#define MP make_pair                             // pairのコンストラクタ
#define F first                                  // pairの一つ目の要素
#define S second                                 // pairの二つ目の要素
#define CST(x) cout << fixed << setprecision(x)  //小数点以下の桁数指定
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int gcd(int a, int b) {
    if (b == 0)
        return a;
    else
        return gcd(b, a % b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
//各桁の和
int sumDight(int x) {
    int sum = 0;
    while (x > 0) {
        sum += (x % 10);
        x /= 10;
    }
    return sum;
}
//回文数
int divideReverse(int x) {
    int reverse = 0;
    int r;
    while (x > 0) {
        r = x % 10;
        reverse = reverse * 10 + r;
        x /= 10;
    }
    return reverse;
}

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);

    int n, m;
    cin >> n;
    vector<string> s(110);
    rep(i, n) cin >> s[i];
    cin >> m;
    vector<string> t(110);
   rep(i, m) cin >> t[i];

    map<string, int> a;
    rep(i, n) { a[s[i]] += 1; }
    rep(i, m) a[t[i]] -= 1;
    int ma = -100;
    rep(i, a.size()) if (ma < a.at(s[i])) ma = a.at(s[i]);
    

    if(ma>0)cout << ma << endl;
    else
        cout << 0 << endl;
}
//  [c]
#include<stdio.h>
#include<stdlib.h>

int main(void)
{
    int n, m;
    int ans = 0;
    char s[100][10];
    char t[100][10]; 

    scanf("%d", &n);
    for (int i = 0; n > i; i++) {
        scanf("%s", s[i]);
    }
    scanf("%d", &m);
    for (int i = 0; m > i; i++) {
        scanf("%s", t[i]);
    }
    for (int i = 0; n > i; i++) {
        int tmp = 0;
        for (int j = 0; n > j; j++) {
            if (0 == strcmp(s[i], s[j])) {
                tmp++;
            }
        }
        for (int j = 0; m > j; j++) {
            if (0 == strcmp(s[i], t[j])) {
                tmp--;
            }
        }
        if (tmp > ans) {
            ans = tmp;
        }
    }

    printf("%d\n", ans);
    return 0;
}
//  [c]
#include <stdio.h>
#include <string.h>
#include <stdbool.h>

#define MAX_NUMBER_OF_CARD	100
#define WORD_LENGTH_MAX	10

int main()
{
    int n, m;
    char blue[MAX_NUMBER_OF_CARD][WORD_LENGTH_MAX + 1];
    char red[MAX_NUMBER_OF_CARD][WORD_LENGTH_MAX + 1];

    bool need_add;
    char words[MAX_NUMBER_OF_CARD][WORD_LENGTH_MAX + 1];
    int number_of_words = 0;

    int score;
    int high_score = -100;
    
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
	scanf("%s", blue[i]);
    }
    scanf("%d", &m);
    for (int i = 0; i < m; i++)
    {
	scanf("%s", red[i]);
    }

    for (int i = 0; i < n; i++)
    {
	need_add = true;
	for (int j = 0; j <= number_of_words; j++)
	{
	    if (strcmp(blue[i], words[j]) == 0)
	    {
		need_add = false;
		break;
	    }
	}
	if (need_add)
	{
	    strcpy(words[number_of_words], blue[i]);
	    number_of_words++;
	}
    }

    for (int i = 0; i < m; i++)
    {
	need_add = true;
	for (int j = 0; j <= number_of_words; j++)
	{
	    if (strcmp(red[i], words[j]) == 0)
	    {
		need_add = false;
		break;
	    }
	}
	if (need_add)
	{
	    strcpy(words[number_of_words], red[i]);
	    number_of_words++;
	}
    }
    
    for (int i = 0; i < number_of_words; i++)
    {
	score = 0;
	for (int j = 0; j < n; j++)
	{
	    if (strcmp(words[i], blue[j]) == 0)
	    {
		score++;
	    }
	}

	for (int j = 0; j < m; j++)
	{
	    if (strcmp(words[i], red[j]) == 0)
	    {
		score--;
	    }
	}

	if (score > high_score)
	{
	    high_score = score;
	}
    }

    if (high_score < 0)
    {
	high_score = 0;
    }
    printf("%d\n", high_score);

    return 0;
}
//  [c]
#include<stdio.h>
#include<string.h>
//20000桁のマージソート(1単語10文字以下)
char c[101][11];
int sort(int a,int b,char s[][11]){
  if(a==b)
    return 0;
  sort(a,(a+b)/2,s);
  sort((a+b)/2+1,b,s);
  int i=a,j=(a+b)/2+1,k=a;
  while(k<=b){
    if(i<(a+b)/2+1 && j<b+1){
      if(strcmp(s[i],s[j])<0){
        strcpy(c[k],s[i]);
        i++;
      }
      else{
        strcpy(c[k],s[j]);
        j++;
      }
    }
    else if(j>b){
      strcpy(c[k],s[i]);
      i++;
    }
    else{
      strcpy(c[k],s[j]);
      j++;
    }
    k++;
  }
  for(i=a;i<=b;i++)
    strcpy(s[i],c[i]);
  return 0;
}

int main(){
  int n,m,i,max=0;
  scanf("%d",&n);
  char s[n+1][11];
  for(i=0;i<n;i++)
    scanf("%*c%s",s[i]);
  scanf("%d",&m);
  sort(0,n-1,s);
  char t[m+1][11];
  for(i=0;i<m;i++)
    scanf("%*c%s",t[i]);
  sort(0,m-1,t);
  int count=1,tnum=0;
  for(i=0;i<n;i++){
    if(strcmp(s[i],s[i+1])==0 && i<n-1)
      count++;
    else{
      while(strcmp(t[tnum],s[i])<0 && tnum<m)
        tnum++;
      while(strcmp(t[tnum],s[i])==0 && tnum<m){
        tnum++;
        count--;
      }
      if(max<count)
        max=count;
      count=1;
    }
  }
  printf("%d\n",max);
  return 0;
}
//  [c]
a[2048];s;i=2048;
main(n,c){
	for(scanf("%d ",&n);n--;++a[s])for(s=0;(c=getchar())>10;)s+=c;
	for(scanf("%d ",&n);n--;--a[s])for(s=0;(c=getchar())>10;)s+=c;
	for(;--i;)n=fmax(n,a[i]);
	printf("%d",n);
}
//  [c]
#include <stdio.h>
#include <string.h>

int main(void)
{
    int N,M;
    int en=0, tmp;
    char Blue[100][11];
    char Red[100][11];

    scanf("%d",&N);
    for(int i=0; i<N; i++){
        gets(Blue[i]);
        //printf("%s\n\n",Blue[i]);
    }
    scanf("%d",&M);
    for(int i=0; i<M; i++){
        gets(Red[i]);
    }

    //printf("N = %d,  M = %d\n",N,M);

    //全探索
    for(int i=0; i<N-1; i++){
        tmp = 0;
        for(int j=i+1; j<N; j++){
            if(strcmp(Blue[i],Blue[j]) == 0) tmp++;
        }
        for(int k=0; k<M; k++){
            if(strcmp(Blue[i],Red[k]) == 0) tmp--;
        }
        if(en < tmp) en = tmp;
    }

    printf("%d\n",en);

    return 0;
}
//  [c]
#include <stdio.h>
#include <string.h>

int main(void)
{
    int N,M;
    int en=0, tmp;
    char Blue[100][11];
    char Red[100][11];

    scanf("%d",&N);
    for(int i=0; i<N; i++){
        gets(Blue[i]);
        //printf("%s\n\n",Blue[i]);
    }
    scanf("%d",&M);
    for(int i=0; i<M; i++){
        gets(Red[i]);
    }

    //printf("N = %d,  M = %d\n",N,M);

    //全探索
    for(int i=0; i<N-1; i++){
        for(int j=i+1; j<N; j++){
            if(strcmp(Blue[i],Blue[j]) == 0) tmp++;
        }
        for(int k=0; k<M; k++){
            if(strcmp(Blue[i],Red[k]) == 0) tmp--;
        }
        if(en < tmp) en = tmp;
    }

    printf("%d\n",en);

    return 0;
}
//  [javascript]
function main(input) {
  input = input.split(/\r\n|\r|\n/);
  const n = parseInt(input[0]);
  const s = input.slice(1,n+1);
  const m = parseInt(input[n+1]);
  const t = input.slice(n+2);
  const o = {};
  s.forEach(si => {
    if(!o[si]) o[si] = 0;
    o[si]++;
  });
  t.forEach(ti => {
    if(!o[ti]) o[ti] = 0;
    o[ti]--;
  });
  var max = 0;
  Object.keys(o).forEach(k => {
    max = Math.max(max, o[k]);
  });
  console.log(max);
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(s) {
	s = s.split("\n");
	var n = parseInt(s[0]);
	var a = {0:0};
	for(var i = 0; i < n; i++){
		if(!a[s[i+1]]) a[s[i+1]] = 1;
		else a[s[i+1]]++;
	}
	var m = parseInt(s[n+1]);
	for(var i = 0; i < m; i++){
		if(a[s[n+i+2]]) a[s[n+i+2]]--;
	}
	var max = 0;
	for(i in a){
		if(max < a[i]) max = a[i];
	}
	console.log(max);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
//  [javascript]
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input,
  "index" : 0,
  "max" : input.length,
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  },
  "hasNext" : function(){return (this.index < this.max);}
}
Main();
function next(){return obj.next();}
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var N = nextInt();
  var list = {};
  for(var i = 0; i < N; i++){
    var s = next();
    if(list[s] == null){
       list[s] = 1;
    }else{
       list[s]++;
    }
  }
  var M = nextInt();
  for(var i = 0; i < M; i++){
    var t = next();
    if(list[t] != null){
       list[t]--;
    }
  }
  var output = 0;
  var keys = Object.keys(list);
  for(var i = 0 ; i < keys.length; i++){
    output = Math.max(output,list[keys[i]]);
  }
  myout(output);
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

//Util
func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func minInt(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

func absInt(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func absFloat64(a float64) float64 {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func minFloat64(a, b float64) float64 {
	if a > b {
		return b
	} else {
		return a
	}
}

func str2Int(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}

//Main
var sc = bufio.NewScanner(os.Stdin)
var N, M int
var A map[string]int

const MAX = 200

func main() {
	sc.Split(bufio.ScanWords)
	A := make(map[string]int, MAX)
	N = nextInt()
	for i := 0; i < N; i++ {
		s := nextStr()
		//mapにkeyが存在するか判定
		if _, ok := A[s]; ok {
			A[s]++
		} else {
			A[s] = 1
		}
	}

	M = nextInt()
	for i := 0; i < M; i++ {
		s := nextStr()
		//mapにkeyが存在するか判定
		if _, ok := A[s]; ok {
			A[s]--
		} else {
			A[s] = -1
		}
	}

	ans := -200
	for _, v := range A {
		if v > ans {
			ans = v
		}
	}

	fmt.Println(maxInt(0, ans))
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const mod = 1000000007

// 1MB
const ioBufferSize = 1 * 1024 * 1024

var sc = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	sc.Split(bufio.ScanWords)
	return sc
}()

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	ss := map[string]int{}

	n := nextInt()
	for i := 0; i < n; i++ {
		ss[next()]++
	}
	m := nextInt()
	for i := 0; i < m; i++ {
		ss[next()]--
	}

	max := 0
	for _, x := range ss {
		if max < x {
			max = x
		}
	}
	fmt.Println(max)
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func solve() {
	cnt := make(map[string]int)

	n := getInt()
	for i := 0; i < n; i++ {
		s := getString()
		cnt[s]++
	}

	m := getInt()
	for i := 0; i < m; i++ {
		t := getString()
		cnt[t]--
	}

	ans := 0
	for _, c := range cnt {
		ans = max(ans, c)
	}
	fmt.Fprintln(wr, ans)
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

// -----------------------------------------

const (
	inf = 1 << 60
	// mod = 1000000007
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	maxBufSize := int(1e8)
	sc.Buffer(make([]byte, 4096), maxBufSize)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() (ret int) {
	sc.Scan()
	ret, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return
}

func getIntSlice(n int) (ret []int) {
	ret = make([]int, n)
	for i := range ret {
		ret[i] = getInt()
	}
	return
}

func getString() (ret string) {
	sc.Scan()
	ret = sc.Text()
	return
}

func getRunes() (ret []rune) {
	ret = []rune(getString())
	return
}
//  [go]
package main

import "fmt"

func main() {
	var (
		N, M int
		s, t string
	)
	var st = map[string]int{}

	fmt.Scan(&N)
	for i := 0; i < N; i++ {
		fmt.Scan(&s)
		st[s]++
	}

	fmt.Scan(&M)
	for i := 0; i < M; i++ {
		fmt.Scan(&t)
		st[t]--
	}

	max := 0
	for _, v := range st {
		if max < v {
			max = v
		}
	}

	fmt.println(max)
}
//  [go]
package main

import "fmt"

func main() {
	var (
		N, M int
		s, t string
	)
	var st = map[string]int{}

	fmt.Scan(&N)
	for i := 0; i < N; i++ {
		fmt.Scan(&s)
		st[s]++
	}

	fmt.Scan(&M)
	for i := 0; i < M; i++ {
		fmt.Scan(&t)
		st[t]--
	}

	max := 0
	for _, v := range st {
		if max < v {
			max = v
		}
	}

	println(max)
}
//  [go]
package main

import "fmt"

func main() {
	var n, m int
	var t string
	fmt.Scan(&n)
	s := make(map[string]int)
	ans := -100
	for i := 0; i < n; i++ {
		fmt.Scan(&t)
		s[t]++
	}
	fmt.Scan(&m)
	for i := 0; i < m; i++ {
		fmt.Scan(&t)
		s[t]--
	}
	for _, v := range s {
		if v > ans {
			ans = v
		}
	}
	fmt.Println(ans)
}
//  [ruby]
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return [init]*size1
  else
    return [[init]*size2]*size1
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

N=gets.to_i
kind=Hash.new(0)
N.times do
    s=gets.chomp
    kind[s]+=1
end
M=gets.to_i
M.times do
    t=gets.chomp
    kind[t]-=1
end
max=0
kind.each do|k,v|
    max=max(max,v)
end
puts max
//  [ruby]
n = gets.to_i
hash = Hash.new(0)
n.times do
  s = gets.chomp
  hash[s] += 1
end
m = gets.to_i
m.times do
  t = gets.chomp
  hash[t] -= 1
end
val = hash.sort_by{|k,v| -v}.to_a[0][1]
if val < 0
  puts 0
else
  puts val
end
//  [ruby]
N = gets.to_i
hash = {}
N.times do
    s = gets.chomp
    hash[s] = hash[s].to_i + 1
end
 M = gets.to_i
 M.times do
    s = gets.chomp
    hash[s] = hash[s].to_i - 1
 end
 puts [hash.values.max, 0].max
//  [ruby]
N = gets.to_i
s = N.times.map { gets.chomp }
M = gets.to_i
t = M.times.map { gets.chomp }

m = s.inject({}) {|acc, str|
  acc[str] ||= 0
  acc[str] += 1
  acc
}

m = t.inject(m) {|acc, str|
  acc[str] ||= 0
  acc[str] -= 1
  acc
}

puts m.values.max
//  [ruby]
ary = []
n = gets.to_i
blue = n.times.map{gets.chomp}.group_by(&:itself).map{|k,v|[k,v.count]}.to_h
m = gets.to_i
red = m.times.map{gets.chomp}.group_by(&:itself).map{|k,v|[k,v.count]}.to_h
blue.each_key{|k|red.include?(k) ? ary<<blue[k]-red[k] : ary<<blue[k]}
puts ary.size==1 && ary.first<0 ? 0 : ary.max
//  [ruby]
n = gets.to_i
words = []
blue_words = []
red_words = []
for i in 1..n
  s = gets.chomp
  words << s
  blue_words << s
end
m = gets.to_i
for i in 1..m
  t = gets.chomp
  words << t
  red_words << t
end
words.uniq!

sums = []
words.each do |w|
#   p "#{blue_words.count(w)} #{red_words.count(w)}"
  sums << blue_words.count(w) - red_words.count(w)
end

puts sums.max
//  [rust]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

use std::collections::HashMap;
fn main() {
    input! {
        n: usize,
        s: [String; n],
        m: usize,
        t: [String; m],
    };
    let mut map = HashMap::new();
    for st in s {
        *map.entry(st).or_insert(0i32) += 1;
    }
    for st in t {
        *map.entry(st).or_insert(0) -= 1;
    }
    println!(
        "{}",
        map.values()
            .map(|&n| if n > 0 { n } else { 0 })
            .max()
            .unwrap()
    );
}
//  [rust]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

use std::collections::HashMap;
fn main() {
    input!{
        n: usize,
        s: [String; n],
        m: usize,
        t: [String; m],
    };
    let mut map = HashMap::new();
    for st in s{
        *map.entry(st).or_insert(0i32) += 1;
    }
    for st in t{
        *map.entry(st).or_insert(0) -= 1;
    }
    println!(
        "{}",
        map.values().map(|&n| if n > 0{n}else{0}).max().unwrap()
    );
}
//  [rust]
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

use std::collections::HashMap;

fn main() {
    let n: usize = read();
    let mut map: HashMap<String, i64> = HashMap::new();
    for _ in 0..n {
        let si: String = read();
        let current = map.entry(si).or_insert(0);
        *current += 1;
    }
    let m: usize = read();
    for _ in 0..m {
        let si: String = read();
        let current = map.entry(si).or_insert(0);
        *current -= 1;
    }
    let mut ans = 0;

    for i in map {
        if i.1 > ans {
            ans = i.1;
        }
    }
    println!("{}", ans);
}
//  [rust]
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n:u32 = read();
    let b:Vec<String> = (0..n).map(|_| read()).collect();
    let m:u32 = read();
    let r:Vec<String> = (0..m).map(|_| read()).collect();

    let mut l = b.clone();
    l.sort();
    l.dedup();
    let mut ans = 0;
    for i in l {
        let temp = b.iter().filter(|&j| *j == i).count() - r.iter().filter(|&k| *k == i).count();
        if temp > ans {
            ans = temp;
        }
    }
    println!("{}", ans);
}
//  [rust]
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

use std::cmp::{max, min};
use std::collections::HashMap;

fn main() {
  let mut dist: HashMap<String, i64> = HashMap::new();
  let n = read::<i64>();
  for _ in 0..n {
    let word = read::<String>();
    let current = dist.entry(word).or_insert(0);
    *current += 1;
  }

  let m = read::<i64>();
  for _ in 0..m {
    let word = read::<String>();
    let current = dist.entry(word).or_insert(0);
    *current -= 1;
  }

  let mut ans_max = 0;
  let mut ans = "";
  for (k, v) in dist.iter() {
    if ans_max < *v {
      ans = k;
      ans_max = *v;
    }
  }

  println!("{:?}", ans);
}
//  [rust]
use std::cmp::max;
use std::collections::HashMap;

fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let n: usize = read(&mut stdin_lock, &mut buf, b'\n');
    let mut map: HashMap<String, i32> = HashMap::new();
    for _ in 0..n {
        let k: String = read(&mut stdin_lock, &mut buf, b'\n');
        let v: i32 = *map.get(&k).unwrap_or(&0);
        map.insert(k, v + 1);
    }
    let m: usize = read(&mut stdin_lock, &mut buf, b'\n');
    for _ in 0..m {
        let k: String = read(&mut stdin_lock, &mut buf, b'\n');
        match map.get(&k) {
            Some(&v) => map.insert(k, v - 1),
            None => None,
        };
    }

    let max_key = map.keys().max_by_key(|&k| map.get(k).unwrap()).unwrap();
    let ans = max(map.get(max_key).unwrap(), &0);
    println!("{}", ans);
}
//  [swift]
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element {
        return self.maxElement()!
    }
    func min() -> Element {
        return self.minElement()!
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/

//var min, min2, count: Int!
//for i in 1...10 {
//    let x = readInt()!
//    if i == 1 {
//        min = x
//        count = 1
//    } else if x < min {
//        min2 = min
//        min = x
//        count = 1
//    } else if x == min && count == 1 {
//        min2 = x
//        count = 2
//    }
//}
//print(min2)

/*************** メインプログラム ***************/

let N = readInt()!
var blue = [String : Int]()
for _ in 0..<N {
    let s = readLine()!
    if blue[s] == nil {
        blue[s] = 1
    } else {
        blue[s] = blue[s]! + 1
    }
}
let M = readInt()!
var red = [String : Int]()
for _ in 0..<M {
    let s = readLine()!
    if red[s] == nil {
        red[s] = 1
    } else {
        red[s] = red[s]! + 1
    }
}
var ans = 0
for (s, _) in blue {
    ans = max(blue[s]! - (red[s] ?? 0), ans)
}
print(ans)
//  [swift]
var b=[String:Int]()
for _ in 0..<Int(readLine()!)!{
    let s=readLine()!
    b[s]=(b[s] ?? 0)+1
}
var r=[String:Int]()
for _ in 0..<Int(readLine()!)!{
    let t=readLine()!
    r[t]=(r[t] ?? 0)+1
}
var ans=0
for (s,_) in b{
    ans=max(b[s]!-(r[s] ?? 0),ans)
}
print(ans)
//  [swift]
var b=["":0]
for _ in 0..<Int(readLine()!)!{
    let s=readLine()!
    b[s]=(b[s] ?? 0)+1
}
for _ in 0..<Int(readLine()!)! {
    let t=readLine()!
    b[t]=(b[t] ?? 0)-1
}
print(b.sort{$0.1>$1.1}[0].1)
//  [swift]
var b=["":0]
for _ in 0..<Int(readLine()!)!{
    let s=readLine()!
    b[s]=(b[s] ?? 0)+1
}
for _ in 0..<Int(readLine()!)! {
    let t=readLine()!
    b[t]=(b[t] ?? 0)-1
}
print(b.sort{$0.1>$1.1}[0].value)
//  [swift]
var b=["":0]
for _ in 0..<Int(readLine()!)!{
    let s=readLine()!
    b[s]=(b[s] ?? 0)+1
}
for _ in 0..<Int(readLine()!)! {
    let t=readLine()!
    b[t]=(b[t] ?? 0)-1
}
print(b.sort{$0.value>$1.value}[0].value)
//  [swift]
var b=["":0]
for _ in 0..<Int(readLine()!)!{
    let s=readLine()!
    b[s]=(b[s] ?? 0)+1
}
for _ in 0..<Int(readLine()!)! {
    let t=readLine()!
    b[t]=(b[t] ?? 0)-1
}
print(b.max{$0.value<$1.value}!.value)
//  [typescript]
import * as fs from 'fs';

namespace AtCoder {
    export interface Paramable {
        readonly args: string[][];
    }

    export interface Task {
        main(this: Task): void;
    }
}

namespace AtCoder.abc091 {
    export class TaskB implements AtCoder.Paramable, AtCoder.Task {
        constructor(readonly args: string[][]) {
        }

        main(this: TaskB): void {
            const n: number = parseInt(this.args[0][0], 10);
            const m: number = parseInt(this.args[n + 1][0], 10);
            const map = new Map;

            for (let i = 0; i < n; i++) {
                const key: string = this.args[i + 1][0];
                if (!map.has(key)) {
                    map.set(key, 0);
                }
                map.set(key, 1 + map.get(key))
            }

            for (let i = 0; i < m; i++) {
                const key: string = this.args[n + i + 2][0];
                if (!map.has(key)) {
                    map.set(key, 0);
                }
                map.set(key, -1 + map.get(key));
            }

            const array: number[] = [];
            map.forEach((value) => {
                array.push(value);
            });

            const ans: number = Math.max(...array);
            console.log(ans > 0 ? ans : 0);
        } 
    }

    const args: string[][] = fs.readFileSync('/dev/stdin', 'utf8').trim().split('\n').map(x => x.split(' '));
    const task: AtCoder.Task = new TaskB(args);
    task.main();
}
//  [typescript]
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8').trim()

const n = Number(stdin.split('\n')[0])
const s = stdin.split('\n').slice(1, n + 1)
const m = Number(stdin.split('\n')[n + 1])
const t = stdin.split('\n').slice(n + 2, n + 2 + m)

const getTotal = str => {
  let total = 0
  for (let i = 0; i < n; i++) {
    if (s[i] === str) {
      total++
    }
  }

  for (let i = 0; i < m; i++) {
    if (t[i] === str) {
      total--
    }
  }

  return total
}

const ans = () => {
  const totals = s.map(str => getTotal(str))

  const max = Math.max(...totals)

  return max < 0 ? 0 : max
}

console.log(ans())
//  [typescript]
const log = console.log;

const createScanFunctions = (input: string) => {
  const str = input.trim();
  const len = str.length;
  let index = 0;

  const scan = () => {
    const startIndex = index;

    while (index < len) {
      const char = str[index];

      if (char === " " || char === "\n")
        return str.substring(startIndex, index++);

      index++;
    }

    return str.substr(startIndex);
  };

  const scanInt = () => parseInt(scan());

  return { scan, scanInt };
};

// ----

function addMappedValue<T>(map: Map<T, number>, key: T, v: number) {
  map.set(key, (map.get(key) || 0) + v);
}

// ----

function Main(input: string): void {
  const { scan, scanInt } = createScanFunctions(input);

  const wordPointMap = new Map<string, number>();

  const n = scanInt();

  for (let i = 0; i < n; i++) addMappedValue(wordPointMap, scan(), 1);

  const m = scanInt();

  for (let i = 0; i < m; i++) addMappedValue(wordPointMap, scan(), -1);

  log(Math.max(0, ...Array.from(wordPointMap.values())));
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);const tn=():number=>{const a=input[0];input.shift();return Number(a)};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{const a=input[0];input.shift();return String(a)};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const tc=():string=>{let a=input[0].split('');const b=a[0];a.shift();if(a.length>0){input[0]=a.join('')}else{input.shift()}return String(b)};const tcc=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(tc())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1];}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};
const main=()=>{
  let o={}
  let n=tn()
  let na=tss(n)
  for(let i=0;i<n;i++)o[na[i]]=0;
  let m=tn()
  let ma=tss(m)
  for(let i=0;i<m;i++)o[ma[i]]=0;
  for(let i=0;i<n;i++)o[na[i]]+=1
  for(let i=0;i<m;i++)o[ma[i]]-=1
  to(max(...Object.values(o))<0?0:max(...Object.values(o)))
}
main()
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);const tn=():number=>{const a=input[0];input.shift();return Number(a)};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{const a=input[0];input.shift();return String(a)};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const tc=():string=>{let a=input[0].split('');const b=a[0];a.shift();if(a.length>0){input[0]=a.join('')}else{input.shift()}return String(b)};const tcc=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(tc())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1];}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};
const main=()=>{
  let o={}
  let n=tn()
  let na=tss(n)
  for(let i=0;i<n;i++)o[na[i]]=0;
  let m=tn()
  let ma=tss(m)
  for(let i=0;i<m;i++)o[ma[i]]=0;
  for(let i=0;i<n;i++)o[na[i]]+=1
  for(let i=0;i<m;i++)o[ma[i]]-=1
  to(max(...Object.values(o)))
}
main()
//  [python]
A, B = map(int, input().split())
print (max(A+B, A-B, A*B))