You have a URL-shortening service that registered users can use to create custom short links for any website. The service can also be used through an API which has the following requirements:
If all the conditions are met, then the custom key is added to the database and it redirects to the given website. The database is empty before the first query and after that, the custom keys of successful queries are added to the database one by one.
You will be given a list of queries made to the API in chronological order. Determine whether each query is successful. Each query will contain the following:
Task
You are given N queries. If a query is successful, print "YES" else print "NO".
Example
Assumptions
Approach
Function description
Complete the function solve provided in the editor. This function takes the following 2 parameters and returns the required answer:
Input format
Note: This is the input format that you must use to provide custom input (available above the Compile and Test buttons).
Output format
For each query, print either "YES" or "NO" (case-sensitive) depending on whether the query is successful or not.
Constraints
4 1000000000 https://www.google.com gg1 25 1000000004 https://www.youtube.com yt 26 1000000004 https://HackerEarth.com he 50 1000000005 https://www.facebook.com F!B 25