Submit | All submissions | Best solutions | Back to list |
MANIP001 - Basic text manipulation 01 |
Some documents in telecom domain specifies information in a stupid bad style.
One of those styles, is to write many parameters in a single line.
In this problem you will be given the input in the following format:
TYPE 1:[space?]<A_NUMBER>[space?], TYPE 2:[space?]<B_NUMBER>[space?], TYPE 3:[space?]<C_NUMBER>[space?], TYPE details:[space?]<D_TEXT>
You will extract the parameters and write them in the following style:
(A_NUMBER,<B_NUMBER_x>,<C_NUMBER_x>,'<D_TEXT>')
Input
t: number of test cases 1<= t <=20
Then comes t lines with the following format (bold text is for parameters)
TYPE 1:[space?]<A_NUMBER>[space?], TYPE 2:[space?]<B_NUMBER>[space?], TYPE 3:[space?]<C_NUMBER>[space?], TYPE details:[space?]<D_TEXT>
<A_NUMBER>: An Integer between 0 and 100
<B_NUMBER>: An Integer between 0 and 100 OR empty IF A_NUMBER IS 0
<C_NUMBER>: An Integer between 0 and 100 OR empty IF B_NUMBER IS (0 or empty)
<D_TEXT>: A string of readable characters, the length of it is between 1 and 20
[space?]: means that there might be a space there.
Output
t lines, each of the following format
(<A_NUMBER>,<B_NUMBER_x>,<C_NUMBER_x>,'<D_TEXT>')
Where B_NUMBER_x is B_NUMBER or NULL if B_NUMBER was empty
and C_NUMBER_x is C_NUMBER or NULL if C_NUMBER was empty
Note the single quotes around <D_TEXT>.
Example
Input: 3
TYPE 1: 2, TYPE 2: 0, TYPE 3: , TYPE details: n/a
TYPE 1: 2, TYPE 2: 1, TYPE 3:0 , TYPE details: nothing
TYPE 1: 0, TYPE 2: , TYPE 3: , TYPE details: nice Output: (2,0,NULL,'n/a')
(2,1,0,'nothing')
(0,NULL,NULL,'nice')
Added by: | Mostafa 36a2 |
Date: | 2022-06-08 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |
Resource: | TD57 |