题目描述
Problem Description
Common text editors have a feature to find words, which can quickly locate the position of specific words in a text and sometimes even count the occurrences of specific words.
Now, you are asked to program this functionality. Specifically, given a word, you need to output the number of times it appears in the given text and the position of its first occurrence. Note: When matching words, case should be ignored, but an exact match is required. The given word must be identical to a standalone word in the text, ignoring case (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
There are 2 lines in total.
The first line is a string containing only letters, representing the given word.
The second line is a string that may only contain letters and spaces, representing the given text.
Output Format
One line. If the given word is found in the text, output two integers separated by a space, representing the number of times the word appears in the text and the position of its first occurrence (i.e., the position of the first letter of the word in the text, with positions starting from 0). If the word does not appear in the text, output the integer -1.
Note: Spaces occupy one character position.
Sample Input and Output
Sample Input #1
To
to be or not to be is a question
Sample Output #1
2 0
Sample Input #2
to
Did the Ottoman Empire lose its power at that time
Sample Output #2
-1
Notes
Data Range
$1 \leq$ Length of the first line word $\leq 10$.
$1 \leq$ Length of the text $\leq 10^6$.
This is the second question from the NOIP2011 Junior Group.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分