918 - I2P(II)2016_Chen_Lab_0 Scoreboard

Time

2016/02/19 13:40:00 2016/02/19 15:00:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
10943 Search Dictionary

10943 - Search Dictionary   

Description

There are 20 words in the dictionary, which are stored in char dictionary [N_WORDS][4]. N_WORDS is the total number of words which is 20 in this problem. Each dictionary[i] contains a three-letter string. For example, printf(“%s\n”, dictionary[2]) will print “cat”.

The user will input N three-letter strings (1<=N<=100) and each string only contains lowercase letters. The function find_words is to search the dictionary and print strings with any arrangement. For example, if the input is “eat”, you need to print “ate”, ”eat”, ”tea” because these three words are in the dictionary and they can be obtained from eat with some rearrangement. If there is no matched words in the dictionary, you need to print none.

We have provided the example source code below. You need to implement two functions.

void count_letters(char *input_str, int *counts);
int equal_counts(int *counts1, int *counts2);

count_letter is to count the number of occurrences of each letter from 'a' to 'z'. counts[0] for 'a', counts[1] for 'b', ..., etc.

equal_count will return 1 if the two arrays counts1[] and counts2[] contain exactly the same values. Otherwise, return 0.

Also, you are free to implement the whole code by yourself.

 

main.c

Input

N strings

Output

Print out all of the matched words in each line.

Each line contains the matched words in the order of dictionary and separated by “,”. If there is not any matched words, you need to print “none”.

Note that you NEED to print ‘\n’ at the end of each word.

Sample Input  Download

Sample Output  Download

Tags

10402Contest



Discuss