# | Problem | Pass Rate (passed user / total user) |
---|---|---|
12507 | Searching Remark |
|
12523 | Inventory |
|
Description
You are going to design a searching engine on finding articles. User will enter some key words, and then the engine will find the most suitable article based on the key words.
(The picture is just for reference. You are not going to implement a google.)
How suitable is an article regarding the key word? The searching engine will scan through the article, and count how many remarks there are in the article for a key word. The rule for remark is listed as below:
-
A key word only contains upper case and lower case English alphabets.
-
Words in the article are separated by the following separator symbols : white space
' '
, new line character'\n'
, hyphen'-'
, slash'/'
, colon':'
, brackets'('
,')'
,'['
,']'
, comma','
, and period'.'
. -
An remark is counted if the key words matches a word in the article under case-insensitive matching. For example, "apple" and "AppLE" are considered a match.
Given a key word and an article, please output the number of remark in the article.
Explanation for sample IO
The words in the article are separated by separator symbols, and every word in the article is highlighted in the picture.
The key word is "ms", and there are two remarks in the article (highlighted in the picture below), and thus output "2". (Note that matching is case-insensitive, so "ms" is considered a match to "MS".)
Hints:
1. Use strtok(). (https://www.tutorialspoint.com/c_standard_library/c_function_strtok.htm)
2. Use fgets(). (https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/fgets-fgetws?view=msvc-170)
Input
The first line contains a string K, begin the key word.
After that, there are several lines, being the content of the article, ended with EOF (end of file).
It is guaranteed that :
-
K is consist of [a-zA-Z] only, and length of K <= 20
-
The article in test case is extracted from a paper submitted to IEEE Transactions on Mobile Computing journal. The link will be available after the lab is over. Only English alphabets, numbers, and the separator symbols mentioned above will appear in the test case.
Output
Output the number of remark. Remember to add a new line character in the end.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
You are going to implement a Pokemon Go Inventory Display System. Given the name, current hp, and max hp of pokemons, you are going to sort them in the following order.
-
The pokemon whose hp is not full (i.e. current hp < max hp) goes to the front
-
The pokemon whose current hp is less goes to the front
-
The pokemon whose max hp is less goes to the front
Please print the names, current hp, and max hp of the pokemons after you finish sorting. Refer to IO for format.
Input
The input is given in the following format :
n name_1 c_1 m_1 ... name_n c_n m_n
The first line contains an integer n (1 <= n <= 100). The next n lines are the names, current hp and max hp for each pokemon.
It is guaranteed that :
-
there will be no two pokemons with both same current hp and same max hp
-
1 <= length of pokemon name <= 20, pokemon name contains English Alphabets only.
-
0 <= current hp <= max hp <= 1000 for each pokemon
Output
Please print the names, current hp, and max hp of the pokemons after you finish sorting. Each line contains the pokemon's name, current hp, max hp, separated by space. There is no trailing space after max hp. Please add a new line character in the end of each line.