NOTE:-
I am really sorry for not writing the code,because stackoverflow won\'t let me post my question due to some unknown indentation errors in the