42: Maximum number of books published, 42:

Source: Internet
Author: User

42: Maximum number of books published, 42:
42: the largest number of books published

  • View
  • Submit
  • Statistics
  • Question
Total time limit:
1000 ms
 
Memory limit:
65536kB
Description

Assume that the Library is new to m (10 ≤ m ≤ 999) books, which are prepared independently or jointly by n (1 ≤ n ≤ 26) authors. Assume that the number of m books is an integer (1 to 999) and the author's name is A letter ('A' to 'Z '), find out the authors who are most involved in the compilation and their book lists based on the book author list.

Input
In the first action, the number of books is m, and in the other m rows, each row is the information of a book. The first integer is the book number, A space is followed by a string consisting of uppercase letters without repeated characters. Each letter represents an author. Input data ensures that only one author has the most data published.
Output
The output has multiple rows:
The first act is the author letter with the largest number of books published;
The number of books published by the second act author;
The number of the books that the authors of other behaviors participate in (output in the input order ).
Sample Input
11307 F895 H410 GPKCV567 SPIM822 YSHDLPM834 BXPRD872 LJU791 BPJWIA580 AGMVY619 NAFL233 PDJWXK
Sample output
P6410567822834791233
Source
Introduction to computing of Peking University 06 psychological and Information Management Final Examination
1 # include <iostream> 2 # include <cstdio> 3 # include <cstring> 4 using namespace std; 5 int a [10001]; 6 int now; 7 int sl [10001]; 8 struct node 9 {10 int a; // number 11 char B [1001]; // author 12 int lb; 13} gs [1001]; 14 int maxn =-1; 15 char ans; 16 int main () 17 {18 int n; 19 cin> n; 20 for (int I = 1; I <= n; I ++) 21 {22 cin> gs [I]. a; 23 // gets (gs [I]. b); 24 scanf ("% s", & gs [I]. b); 25 for (int j = 0; j <strlen (gs [I]. b); j ++) 26 {27 sl [gs [I]. B [j] ++; 28 if (sl [gs [I]. B [j]> maxn) 29 {30 ans = gs [I]. B [j]; 31 maxn = sl [gs [I]. B [j]; 32} 33} 34} 35 cout <ans <endl; 36 cout <maxn <endl; 37 for (int I = 1; I <= n; I ++) 38 {39 for (int j = 0; j <strlen (gs [I]. b); j ++) 40 {41 if (gs [I]. B [j] = ans) 42 {43 cout <gs [I]. a <endl; 44} 45} 46} 47 48 return 0; 49}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.