A deployment tool resolves file references relative to a current base directory. You are given a base directory (an absolute path starting with /) and a target path. Produce the canonical absolute path the target refers to:
- If the target starts with
/, it is absolute and is resolved from the root, ignoring the base. - Otherwise the target is relative: it is resolved starting from the base directory.
- In either case, apply Unix segment rules:
.means the current directory (drop it),..means the parent directory (remove the previous real name; at the root it has no effect), and repeated slashes collapse. - The result starts with a single
/and, unless it is the root, has no trailing/. The root itself is/.
Directory names between slashes consist of lowercase letters and digits only.
Input format
Line 1: the base directory (an absolute path beginning with /).
Line 2: the target path.
Output format
A single line: the canonical absolute resolved path.
Constraints
- 1 <= length of each line <= 200
- The base begins with
/. Both lines use only/, lowercase letters, digits, and.characters.