#Z16112. 【NOIP2011-J2】统计单词数

【NOIP2011-J2】统计单词数

Description

Most text editors have a word search function that can quickly locate specific words in a document, and some can even count the number of times a specific word appears in the text.

Now, you are asked to program this functionality with the following requirements: Given a word, output its number of occurrences and the position of its first appearance in the provided text. Note: When matching the word, case is ignored, but an exact match is required. The given word must exactly match an independent word in the text (case-insensitive, see Sample 1). If the given word is only part of a word in the text, it does not count as a match (see Sample 2).

Input Format

Input consists of two lines:

The first line is a string containing only letters, representing the given word.

The second line is a string that may contain only letters and spaces, representing the given text.

Output Format

Output one line only. If the given word is found in the text, output two integers separated by a space: the number of occurrences of the word in the text and the position of its first appearance (i.e., the position of the first letter of the word's first occurrence in the text, starting from 0). If the word does not appear in the text, output a single integer -1.

```input1 To to be or not to be is a question ``` ```output1 2 0 ``` ```input2 to Did the Ottoman Empire lose its power at that time ``` ```output2 -1 ``` ## Hint

【Data Range】

1 ≤ Word length ≤ 10.

1 ≤ Article length ≤ 1,000,000.

Source

NOIP2011-J2