Nested routes render parent layouts around the child. Input: line 1 — JSON object mapping path → component for nested levels (e.g. {"/": "Root", "/shop": "ShopLayout", "/shop/items": "ItemList"}); line 2 — the URL. Print the render chain for every prefix that exists, outermost first, joined by >.
Input: two lines.
Output: chain like Root > ShopLayout > ItemList.
Your program reads from stdin and prints to stdout.
Example 1
Input: {"/":"Root","/shop":"ShopLayout","/shop/items":"ItemList"} /shop/items
Output: Root > ShopLayout > ItemList
Hints
Nested routes render parent layouts around the child. Input: line 1 — JSON object mapping path → component for nested levels (e.g. {"/": "Root", "/shop": "ShopLayout", "/shop/items": "ItemList"}); line 2 — the URL. Print the render chain for every prefix that exists, outermost first, joined by >.
Input: two lines.
Output: chain like Root > ShopLayout > ItemList.
Your program reads from stdin and prints to stdout.
Example 1
Input: {"/":"Root","/shop":"ShopLayout","/shop/items":"ItemList"} /shop/items
Output: Root > ShopLayout > ItemList
Hints