#P10397. Extract File Title from std::freopen Statement
Extract File Title from std::freopen Statement
Extract File Title from std::freopen Statement
You are given queries. In each query, you are provided with a statement in C++ that exactly follows the format below:
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
, ora
. - : The file stream; it is one of
stdin
,stdout
, orstderr
.
Your task is to extract and output the file name () from each given statement.
inputFormat
The first line contains an integer (), the number of test cases. Each of the following 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>