#P10397. 『STA - R5』5k.sync.closer

『STA - R5』5k.sync.closer

Problem Description

Given a std::freopen statement, output the name of the file it operates on.

Formally, every std::freopen statement should be exactly

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

where <title> is the name of the file it operates on. It contains at least one character, and can only contain the following characters:

  • uppercase English letters;
  • lowercase English letters;
  • Arabic digits;
  • the ASCII dot ..

<mode> is the file access mode, and can only be one of r, w, a. <stream> is the file stream, and can only be one of stdin, stdout, stderr.

You need to answer TT queries.

Input Format

This problem contains multiple queries in a single test case.

The first line contains a positive integer TT, representing the number of queries.

For each query: one line contains a string, representing a std::freopen statement.

Output Format

For each query, output one line with a string, representing the name of the file it operates on.

9
std::freopen("5k.sync.closer","r",stdin);
std::freopen("5k.sync.closer","r",stdout);
std::freopen("5k.sync.closer","r",stderr);
std::freopen("5k.sync.closer","w",stdin);
std::freopen("5k.sync.closer","w",stdout);
std::freopen("5k.sync.closer","w",stderr);
std::freopen("5k.sync.closer","a",stdin);
std::freopen("5k.sync.closer","a",stdout);
std::freopen("5k.sync.closer","a",stderr);

5k.sync.closer
5k.sync.closer
5k.sync.closer
5k.sync.closer
5k.sync.closer
5k.sync.closer
5k.sync.closer
5k.sync.closer
5k.sync.closer

Hint

This problem uses bundled tests.

For 100%100\% of the testdata:

  • 1T10001 \le T \le 1000.
  • The length of each statement does not exceed 10001000.

The detailed score distribution is as follows:

  • Subtask 1 (30pts): the filename is guaranteed to be 5k.sync.closer.
  • Subtask 2 (30pts): the filename length is guaranteed to be 11.
  • Subtask 3 (40pts): no special restrictions.

Translated by ChatGPT 5