0

It is possible to use any

number of characters '/' as a delimiter in path instead of one traditional '/'. For

example,

strings //usr///local//nginx/sbin// and /usr/local/nginx///sbi

n are equivalent. The character '/' (or some sequence of such characters) at the

end of the path is required only in case of the path to the root directory, which can be

represented as single character '/'.

A path called normalized if it contains the smallest possible number of

characters '/'.

Your task is to transform a given path to the normalized form.
Sample Input

//usr///local//nginx/sbin

Sample Output

/usr/local/nginx/sbin

Edited by ايمان_2

3
Contributors
4
Replies
26
Views
4 Years
Discussion Span
Last Post by Ancient Dragon
0

We don't do your assignments for you - read the stickies at the top of the forum.

Write some code, if you have questions, post the code, be direct in what you're having problems with.

0

It is possible to use any number of characters '/' as a delimiter in path instead of one traditional '/'. FIt is possible to use any

No. When in doubt test it in a command prompt. MS-Windows accepts only a single / character immediately before each folder name.

0

AD - you're being too M$-centric.

DOS/Windows use backslash - \

The OP refers to forward slashes / or // or ///, which in Unix/Linux are treated as single slash, so the Google tells me.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.