#P10397. Extract File Title from std::freopen Statement

    ID: 12405 Type: Default 1000ms 256MiB

Extract File Title from std::freopen Statement

Extract File Title from std::freopen Statement

You are given TT queries. In each query, you are provided with a statement in C++ that exactly follows the format below:

std::freopen("<title>","<mode>",<stream>);std::freopen("<title>","<mode>",<stream>);

Here, the components are defined as follows:

  • : A non-empty string representing the file name. It only consists of uppercase letters, lowercase letters, Arabic digits, and the English period (.) character.
  • : The file access mode; it is one of the characters r, w, or a.
  • : The file stream; it is one of stdin, stdout, or stderr.

Your task is to extract and output the file name () from each given statement.

inputFormat

The first line contains an integer TT (T1T \ge 1), the number of test cases. Each of the following TT lines contains a valid C++ statement that exactly follows the format:

std::freopen("<title>","<mode>",<stream>);

There will be no extra spaces between components other than those shown, and the format is strict.

outputFormat

For each test case, output a single line containing the extracted file name ().

sample

3
std::freopen("input.txt","r",stdin);
std::freopen("output.log","w",stdout);
std::freopen("data123.dat","a",stderr);
input.txt

output.log data123.dat

</p>