Path Normalize
NodeJS
Medium
4 views
Problem Description
Normalize a user given path and print the safe version.
Input Format
stdin: one path.
Output Format
Print normalized path.
Sample Test Case
Input:
../meetcode//a/./b
Output:
..\\meetcode\\a\\b
Constraints
Use path.normalize only.
Official Solution
const fs = require('fs');
const path = require('path');
const raw = fs.readFileSync(0, 'utf8').trim();
if (!raw) process.exit(0);
console.log(path.normalize(raw));
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!