#K81892. Approval Request Extraction
Approval Request Extraction
Approval Request Extraction
You are given several lines representing office memos. Some of these lines are requests made by employees and require approval. A valid approval request line follows the pattern:
\(\texttt{Request from \{Name\}: ... - Needs approval}\)
Your task is to extract the name of the employee from every line that contains the phrase Needs approval
and whose first segment (i.e. before the first colon ':') starts with Request from
. Note that if there is no name between Request from
and the colon, an empty string should be returned for that line.
The names should be output in the order they appear in the input.
inputFormat
The first line of input contains an integer \(n\) denoting the number of memo lines. This is followed by \(n\) lines, each representing a memo line.
Input Format:
n memo_line1 memo_line2 ... memo_linen
outputFormat
For every memo line that qualifies as an approval request, output the extracted employee name on a separate line. If no memo line qualifies, output nothing.
## sample5
Request from Alice: Increase budget by 5% - Needs approval
Note: Monthly meeting rescheduled to Friday
Request from Bob: Install new software - Needs approval
Request from Charlie: Change internet provider
Reminder: Complete your timesheets
Alice
Bob
</p>