Fzu 2088 Longest team name

Source: Internet
Author: User

Problem 2088 Longest team name

Problem Description

Jack's class decided to enroll in the Fzu School competition. In order to reflect the unity of the class, the monitor decided to use the class owner's name together to form a history of the longest and most prominent team name.

Because I heard that in the same score, the team name Dictionary small will be ranked in front, the monitor also hope that the longest team name in history has the smallest dictionary order.

Input

The first line of the input data contains an integer t, which represents the number of groups of test data. For each set of test data:

The first behavior is an integer n (0<n<=10000) that represents the number of class members.

Next n Behavior class everyone's name. The name is made up of lowercase letters and each person's name is the same length.

Output for each set of test data, outputs a row that represents the longest team name ever connected. Sample Input13jimtomjoe Sample Outputjimjoetom answerstring has defined &lt, so the sort is also valid for string and does not require a write comparison function. The direct sort will be sorted by dictionary order. Code
#include <iostream>#include<cstdio>#include<string>#include<Set>#include<algorithm>#include<vector>using namespacestd;intMain () {//freopen ("In.txt", "R", stdin);    strings; Vector<string>v; intN; CIN>>N;  while(n--) {v.clear (); intN; CIN>>N;  for(intI=0; i<n;i++) cin>>S,v.push_back (s);        Sort (V.begin (), V.end ());  for(intI=0, Vs=v.size (); i<vs;i++) cout<<V[i]; printf ("\ n"); }    return 0;
View Code

Fzu 2088 Longest team name

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.