2414 - I2P(I)2021_Yang_lab5 Scoreboard

Time

2021/11/02 18:30:00 2021/11/02 20:30:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
11170 The number of occurrences
13309 How much is the string worth 2

11170 - The number of occurrences   

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. All of the strings contain only digits.

 

For example, if A is “50” , n = 3, and the n strings are

“5005”

“055050”

“55000”

then your answer should be 2 because A appears in “5005”  one time,  in “055050” two times, and in “55000” one  time. So the maximum number of occurrences is 2.

 

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

You may assume string B1 is always longer than string A.

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) and a ‘\n’ at the end of the line.

Output

The maximum number of occurrences of A appears in B1, B2, …, Bn. Note that you DO NOT need to print ‘\n’ at the end of the output.

Sample Input  Download

Sample Output  Download

Tags




Discuss




13309 - How much is the string worth 2   

Description

In this problem, the first line of input contains a string C, we define C1 worth 1 coin, C2  worth 2 coins, C3 worth 3 coins ...., C26 worth 26 coins, other charactor worth 0 coin.
Now we have some lines of string (may contain spaces), you need to write a program to calculate how much each line is worth until S0 or end.

Hint:
0_ or _0 ( _ = space) worth 0, not the end of input

Input

The first line contains a string C, Ci worth i coins

The next lines, each line contains a string (may contain spaces)

Testcases:

(4/7) C = abcdefghijklmnopqrstuvwxyz, 0 <=  |S| <= 100, S  end

(1/7) C = abcdefghijklmnopqrstuvwxyz, 0 <=  |S| <= 100

(1/7) C = the permutaion of a ~ z, 0 <=  |S| <= 100S  end

(1/7) C = the permutaion of a ~ z, 0 <=  |S| <= 100

Output

Output the value of each line of string until S = 0 or end.

Sample Input  Download

Sample Output  Download

Tags




Discuss