Write a script or function to parse directory structures (e.g., a PWD-style function). Implement normalize_path(path) for an absolute Unix-style path. Resolve . and .., collapse repeated slashes, and never move above /. Return the canonical absolute path. Input is a string, and output is a string. Examples: /a/./b/../c returns /a/c; /../../x returns /x.
// characters., or ..def normalize_path(path):