← 返回 openai 的题目列表CD Directory Navigation
类型:online_judge
Implement a small command-line program to simulate the behavior of the CD (Change Directory) command. It should support relative and absolute path changes. For example, switch from the root directory 'root/' to a subdirectory 'root/subfolder/', or from 'root/folder' to any parent directory. Ensure the program handles edge cases like invalid paths or exceeding the root directory.
Example
Input
root
subfolder