program in python the following problem We ask that you assist the ITPC by indicating the maximum total number of letters that can be printed on a set of N shirts that are valid to be worn by both teams. For example, if “PÉREZ”, “GONZÁLEZ” and “LÓPEZ” play in the U-18 team, while “GARCIA”, “PERALTA” and “RODRÍGUEZ” play in the U-21 team, the best thing is that a jersey has the prefix "G" with 1 letter (for "GONZALEZ" and "GARCIA" to use), another has the prefix "PER" with 3 letters (for "PÉREZ" and "PERALTA" to use), and another has a 0-letter prefix (to be used by “LOPEZ” and “RODRIGUEZ”). Thus, the answer in this case is 1 + 3 + 0 = 4.   Entry   Each test case is described using three lines. The first line contains an integer N that indicates the number of players in each of the two teams (1≤N≤104). The second line contains the surnames of the N players of the U-18 team. The third line contains the surnames of the N players of the U21 team. Each last name is a non-empty string of at most 100 characters made up of only uppercase letters. In each test case the total number of letters in the 2N surnames is at most 105, and two or more players from the same or different teams may have the same surname. The end of the entry is indicated by a line containing the number −1.   Departure   For each test case, print in the output a line containing an integer that represents the maximum total number of letters that can be printed in a set of N shirts that are valid to be used by both teams.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

program in python the following problem

We ask that you assist the ITPC by indicating the maximum total number of letters that can be printed on a set of N shirts that are valid to be worn by both teams. For example, if “PÉREZ”, “GONZÁLEZ” and “LÓPEZ” play in the U-18 team, while “GARCIA”, “PERALTA” and “RODRÍGUEZ” play in the U-21 team, the best thing is that a jersey has the prefix "G" with 1 letter (for "GONZALEZ" and "GARCIA" to use), another has the prefix "PER" with 3 letters (for "PÉREZ" and "PERALTA" to use), and another has a 0-letter prefix (to be used by “LOPEZ” and “RODRIGUEZ”). Thus, the answer in this case is 1 + 3 + 0 = 4.

 

Entry

 

Each test case is described using three lines. The first line contains an integer N that indicates the number of players in each of the two teams (1≤N≤104). The second line contains the surnames of the N players of the U-18 team. The third line contains the surnames of the N players of the U21 team. Each last name is a non-empty string of at most 100 characters made up of only uppercase letters. In each test case the total number of letters in the 2N surnames is at most 105, and two or more players from the same or different teams may have the same surname. The end of the entry is indicated by a line containing the number −1.

 

Departure

 

For each test case, print in the output a line containing an integer that represents the maximum total number of letters that can be printed in a set of N shirts that are valid to be used by both teams.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Returning value from Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education