# | Problem | Pass Rate (passed user / total user) |
---|---|---|
13290 | Matching Strings |
|
13572 | String Operations 1 |
|
13591 | Second Highest Value |
|
Description
Given a set of strings S1 and some query strings S2. For each strings in S2, you need to determine whether it exists in set S1 or not.
Input
First line contains 2 integers n and m, which is the size of S1 and S2. (0 < n,m <= 100)
Next, there're n lines, each representing a string in S1.
Last, m lines are provided, each representing a string in S2.
The length of strings is not greater than 10^3.
Output
Print m lines. Each line contains "Yes" or "No", which means whether the i-th string in S2 exists in S1 or not.
Print '\n' in the last line.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Input
The first line contains a string s, which consists of only lowercase Latin characters. The second line contains a integer Q. The next Q lines, each contains two characters A and B.
Constraints
- 1≤|s|≤106
- 1≤Q≤105
- A,B∈[a−z]
for testcases 1~3, 1≤|s|≤1000.
for testcases 4~6, there’s no additional constraints.
Output
Print the resulting string in one line after applying the Q operations.
(remember to print a new line character)
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Given an array with length of \(N\).
\(\forall i \in [1, N]\), you have to output the second highest value in the subarray \([1, i]\) (i.e. the second integer after sorting the subarray from higher to lower)
If there are less than two numbers in the subarray, you should print \(0\) instead.
Input
The first line of input contains a number N.
The second line contains N integers.
It is guaranteed that N <= 106 and each number in the array is in the range of [1, 109].
Output
Print one line that contains N numbers, separated by a single white space and end with a newline.
Aftermath, a student in NTHU, is very good at programming. Today, as usual, she comes up with a programming problem but felt bored to solve it by herself(it’s too easy for her!). Thus, she left the problem to you, that is:
Given a string that consists of only lowercase Latin characters, there are Q operations to apply on this string. Each operation is represented by two characters, let’s say A and B, and you have to turn every A in the given string to B. After the Q operations, you should print the resulting string in one line(remember to print a new line character).