Design a simplified file browser that can represent a nested folder structure. Implement a class FileBrowser that supports the following operations:
add_folder(path: str): Add a folder at the specified path. The path uses '/' as a separator and must not contain duplicate folders.add_file(path: str): Add a file at the specified path. The path must include the folder structure leading to the file.list_contents(path: str) -> List[str]: Return a list of all files and folders at the specified path, sorted lexicographically.Example 1:
fb = FileBrowser()
fb.add_folder('/documents')
fb.add_folder('/documents/photos')
fb.add_file('/documents/photos/vacation.jpg')
print(fb.list_contents('/documents/photos')) # Output: ['vacation.jpg']
Example 2:
fb.add_folder('/music')
fb.add_file('/music/song.mp3')
print(fb.list_contents('/music')) # Output: ['song.mp3']
fb = FileBrowser()
fb.add_folder('/documents')
fb.add_folder('/documents/photos')
fb.add_file('/documents/photos/vacation.jpg')
fb.list_contents('/documents/photos')Output['vacation.jpg']WhyThe only file in the 'photos' folder is 'vacation.jpg'.fb.add_folder('/music')
fb.add_file('/music/song.mp3')
fb.list_contents('/music')Output['song.mp3']WhyThe only file in the 'music' folder is 'song.mp3'.Paths are guaranteed to be valid and will not contain leading or trailing slashes.The maximum number of folders and files is 10^5.def add_folder(self, path: str):