-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssignment.txt
More file actions
25 lines (21 loc) · 995 Bytes
/
Assignment.txt
File metadata and controls
25 lines (21 loc) · 995 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Write a console program that parses text according to special characters and writes all possible combinations according to rules:
- text starts with "{" and ends with "}",
- each sentence within text ends with ".",
- options start with "{" and end with "}",
- choices within options are delimited by "|".
Example 1:
Input text:
{This is my {homework|assignment}.}
Program should produce:
This is my homework.
This is my assignment.
Example 2:
Input text:
{ Today is { Monday { and it's working } | Friday { and it's { relaxing | easy} } day }. Tonight is { baseball | football } game. }
Program should produce:
Today is Monday and it's working day. Tonight is baseball game.
Today is Monday and it's working day. Tonight is football game.
Today is Friday and it's relaxing day. Tonight is baseball game.
Today is Friday and it's relaxing day. Tonight is football game.
Today is Friday and it's easy day. Tonight is baseball game.
Today is Friday and it's easy day. Tonight is football game.