Problems

Component Composition

MediumReact Components

Components wrap children. Card(content) returns <div class="card">CONTENT</div>; Page(content) returns <main>CONTENT</main>. Input: line 1 — the inner text; line 2 — a JSON array of wrapper names applied inside-out (e.g. ["Card","Page"] means Page(Card(text))). Print the final markup.

Input: two lines. Output: composed markup.

Your program reads from stdin and prints to stdout.

Example 1

Input: hello ["Card","Page"]

Output: <main><div class="card">hello</div></main>

Hints

ReactComponentsComposition
Component Composition | CodeForge AI