1539 - I2P18_EECS_Mid_1 Scoreboard

Time

2018/11/07 08:05:00 2018/11/07 10:05:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
12059 EECS_2018_Mid1-3
12060 EECS_2018_MID1-2
12061 EECS_2018_MID1-1

12059 - EECS_2018_Mid1-3   

Description

Given a sequence of n distinct integers, sort and print the integers in increasing order with their original positions in the input sequence.
For example, if the original sequence is 7 -3 2 5 12 8
The output should be
-3,2,5,7,8,12
2,3,4,1,6,5

The first line lists the sorted integers in increasing order.
The second lists the original positions of the corresponding integers:
-3 is the second number is the original sequence, 2 is the third number,
5 is the fourth number, and 7 is the first number, so on and so forth.

Input

The first line is an integer T (T <= 20) denoting the number of test cases.

Each test case consists of two lines. The first line contains a number n (n <= 104) indicating the length of the sequence, and the second line contains the sequence of n distinct integers V1, V2, ..., Vn. (-2^31< Vi < 2^31-1 for 1 <= i <= n )

Output

The output of each test case contains two lines. 
The first line lists the sorted integers from the smallest one to the largest one ended by '\n'. Two adjacent numbers should be separated by a comma ',' and no whitespaces in between. The second line lists the original positions, also separated by ',' without whitespace and ended with '\n'.

 

Sample Input  Download

Sample Output  Download

Tags




Discuss




12060 - EECS_2018_MID1-2   

Description

Given a string A and n strings B1, B2, B3, ..., Bn, count the number of occurrences of string A in each of B1, B2, B3, … , and print the maximum number of occurrences. The string A contains only digits, and the strings B1, B2, ..., Bn contain only digits or '#'.  The character '#' is a wildcard character that can match any single digit (0-9).

 
For example, if A is "50", n = 3, and the n strings are
"5005"
"055050"
"5#50#0"
then your answer should be 3 because the maximum number of occurrence is 3: "50" appears in "5005" one time, in "055050" two times, and in "5#50#0" three times ("5#", "50", "#0" all match "50"). 

Note that if A is "99" and B1 is "9999", the number of occurrences of A in B1 is counted as 3.

Input

The first line of the input is the string A (0 < length of A <= 4). The second line is n (1<n<10).

For the next n lines, each line contains a string Bi (length of A < length of Bi < 9).

Output

The maximum number of occurrences of A appears in B1, B2, ..., Bn taking the wildcard character into consideration. Note that you need to print '\n' at the end of the output.

Sample Input  Download

Sample Output  Download

Tags




Discuss




12061 - EECS_2018_MID1-1   

Description

Palindrome is a string that is identical to its reverse, like "level" or "aba". Given a string, find the longest palindrome in the string.

 

Input

The input consists of multiple lines. Each line contains a string.  The length of each string is less than 100.  The number of the test case is less than or equal to 70.

 

Output

In each test case, output the longest palindrome in the string. If there are many palindromes of the same length, output the first one in the string.

Each output should end with '\n'.

 

Sample Input  Download

Sample Output  Download

Tags




Discuss