You are the captain of a world-famous wrestling team. An Olympic-grade match is coming up, and you are determined not to let your team down. You also happen to be a competent programmer, so you are going to write a program to help your team win!
You have access to the strength ratings for each of your own team wrestlers, and each of the opponent wrestlers. A wrestler will win their match only when their strength rating is greater than their opponent's strength rating. You have to write a program that will calculate the optimum pairing for each of your own wrestlers against each of the opponent wrestlers, and then output the maximum number of matches that can be won as a result.
Your program will take as input three strings:
- The number of members per team (there will be an equal number of wrestlers on each team)
- The strength rating of each of your team wrestlers, as a space-separated list
- The strength rating of each of the opponent wrestlers, as a space-separated list
- You don't have to take the first number if you don't want to. It's there if you want it for help iterating through the list/array/string.
- The strength rating is a number between 1 and 10.
- You may input the strength ratings as a list or array instead of a string.
Calculate the optimum pairing for each of your own wrestlers against each of the opponent wrestlers, and then output the maximum number of matches that can be won as a result.
Test case 1:
5 2 4 6 2 6 3 10 6 7 7
Test case 2:
10 1 9 5 5 1 6 2 8 3 6 6 10 2 8 2 3 5 6 10 10
I will upvote all answers that meet the requirements and that include an explanation, to encourage participation and to educate other Code Golfers on how your program works.
There will be no accepted answer since I want to encourage programs in all languages.