Zhejiang Zoo has recently hired a number of program apes, and zoo managers hope to develop these apes as future Nobel, Turing and fields prizes. To this end, the zoo for the Apes launched a special training: writing articles.
In a recent exercise, the monkeys randomly knocked out strings that were no more than 5000 in length, each of which was random from the spaces, half-width punctuation marks, numbers, and the 95 printable characters of the English case.
Administrators believe that if the "Nature & Science" substring (without quotes and case sensitivity) appears in the String, the apes have achieved the training goal of publishing the entire contents of the first "Nature & Science" as an article, For the world to behold. Input format
An integer T that indicates how many sets of test data are available.
The next T line, each line has a string. Note The string may contain spaces, so it is recommended that you read in GetChar () or other similar ways. Output format
For each set of test data, if the monkeys were able to publish an article, they would output a line of string representing the contents of the article, otherwise doing nothing. Sample input
4
) #>alv.riqq;ik3&[<>$
Hello, Nature & Science:world Nature
& Science:hello, world< C3/>the Cake is a Lie. Nature & Science.
Sample output
Hello,
Tips
There is no "nature & Science" in the first set of data, so there is no output.
"Nature & Science" appeared in the remaining sets of data, but the third set of data had no characters before "Nature & Science", so a blank line was exported.
In addition, in order to illustrate the output, some of the sample data is constructed by the zoo administrator, but we guarantee that the actual test data are all written by the apes and strictly conform to the conditions guaranteed in the title description.
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;
int main () {
int T;
String str;
Cin >> T;
GetChar ();
while (t--) {
getline (cin, str);
int pos = Str.find ("Nature & Science");
if (pos >= 0) {
for (int i = 0; i < POS; i++) {
printf ('%c ', str[i]);
}
printf ("\ n")
;
}
return 0;
}
#include <stdio.h>
#include <iostream>
#include <string>
using namespace std;
int main () {
int T;
String str;
scanf ("%d", &t);
GetChar ();
while (t--) {
getline (cin, str);
int pos = Str.find ("Nature & Science");
if (pos = 0) printf ("\ n");
if (pos > 0 && pos < 5010) {
str = str.substr (0, POS);
printf ("%s\n", Str.c_str ());
cout << str << endl;
}
return 0;
}