โ† TCS questions

Format string with forward slashes

Filed under TCS

Given a string, format it by: 1) ensuring it starts with a single forward slash, 2) replacing any sequence of multiple forward slashes with a single slash, and 3) removing any trailing forward slash.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related TCS questions

Collected from public candidate posts and coding forums. Updated Nov 2026.