样例一
当 src 参数为以下值的时候:
{
'https://lintcode.com/problems/design-tinyurl':'http://tinyurl.com/4e9iAk',
}
程序执行打印出的结果为:
{'http://tinyurl.com/4e9iAk': 'https://lintcode.com/problems/design-tinyurl'}
样例二
当 src 参数为以下值的时候:
{
‘https://www.lintcode.com/problem/2370/’:‘https://lt.cn/1/2370’,
‘https://www.lintcode.com/problem/2371/’:‘https://lt.cn/1/2371’,
}
程序执行打印出的结果为:
{'https://lt.cn/1/2370': 'https://www.lintcode.com/problem/2370/', 'https://lt.cn/1/2371': 'https://www.lintcode.com/problem/2371/'}
def reversal(src: dict[str:str]) -> dict[str:str]:
"""
:param src: Original dictionary
:return: Return a reversed dictionary
"""
# -- write your code here --
result = dict()
for key in src:
result[src[key]] = key
return result