In this HackerEarth The art of verification problem solution Cleartrip decided that they wanted to verify the username and password of its users while they were authenticating for a process. One of the code services forms a GET URL which contains the username and password as its parameters. While parsing the URL, the code needs to extract the key-value pairs of ALL the parameters passed in the request URL which may contain '&' or/and '='.
The string can contain any type of alphabetical, numeric, and special characters in the URL.
HackerEarth The art of verification problem solution.
s=input()
un=s[s.find('username')+9:s.find('pwd')-1]
pwd=s[s.find('pwd')+4:s.find('profile')-1]
pr=s[s.find('profile')+8:s.find('role')-1]
r=s[s.find('role')+5:s.find('key')-1]
key=s[s.find('key')+4:]
print("username:",un)
print("pwd:",pwd)
print("profile:",pr)
print("role:",r)
print("key:",key)
0 Comments