next up previous
Next: Web Page Encryption Up: No Title Previous: No Title

Web Search Engine

You have begun working at a start-up company called FindIt.com. Your company which sells customized web search engines and web servers. Your lead programmer caught the flu right before product ship deadline, and you have been called in to finish implementing a web search engine. The existing code crawls through the web, fetching web pages. Your job is to rank them, based on keywords.

For each web page, you need to score the page by finding the number of times a specific keyword appears in the page. Keywords are allowed to be part of other words, so the keyword net appears twice in the sentence ``Networks and intranets''. Keywords are allowed to overlap, so ana should be reported as appearing twice in ``banana''.

Input Format

The input will consist of a keyword on its own line, followed by words from a web page on one or more lines. The input will be terminated by a line containing only -1. You may assume the keyword and all input will be in lowercase.

Output Format

Your program should output the result of your search in the following form:

Found < # > < keyword >

Input:

net
surfing the net today to 
learn etiquette about
networks and intranets 
-1

Output:

Found 3 net

Input:

ana
bananas can be
found in anapolis
-1

Output:

Found 3 ana

Test data used in judging

Input 1 Output 1
Input 2 Output 2

Our Solution



Chau-Wen Tseng
Tue Mar 14 18:48:15 EST 2000