How to print a Python dictionary in this given pattern. I was asked this question in an interview and I couldn't solve it.
Input dictionary:
{"abc":{"def":{"ghi":{"jkl":{"mno":{"pqr":{"stu":{"vwx":{"yz":"you are finally here !!!"}}}}}}}}}
Desired output:
{"abc":["def","ghi","jkl","mno","pqr","stu","vwx","yz"],
"def":["ghi","jkl","mno","pqr","stu","vwx","yz"],
"ghi":["jkl","mno","pqr","stu","vwx","yz"],
"jkl":["mno","pqr","stu","vwx","yz"],
"mno":["pqr","stu","vwx","yz"],
"pqr":["stu","vwx","yz"],
"stu":["vwx","yz"],
"vwx":["yz"],
"yz":["you are finally here !!!"]}