Pick the most specific matching route. Input: line 1 — JSON array of route patterns; line 2 — the URL. Among patterns that match (per the param rules), more literal segments = more specific; tie → earlier in the list. Print the winning pattern or 404.
Input: two lines.
Output: a pattern or 404.
Your program reads from stdin and prints to stdout.
Example 1
Input: ["/users/:id","/users/new"] /users/new
Output: /users/new
Hints
Pick the most specific matching route. Input: line 1 — JSON array of route patterns; line 2 — the URL. Among patterns that match (per the param rules), more literal segments = more specific; tie → earlier in the list. Print the winning pattern or 404.
Input: two lines.
Output: a pattern or 404.
Your program reads from stdin and prints to stdout.
Example 1
Input: ["/users/:id","/users/new"] /users/new
Output: /users/new
Hints