Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Quiz
6. Question 5
Summary

Instruction

Excellent. Only two more questions left!

Exercise

Ask the user for a list of file names separated with semicolons:

Please provide some text:

Your task is to print a new list according to the following rules:

  1. Change all letters to lowercase.
  2. Get rid of leading and trailing spaces in the file names.
  3. If a file name contains spaces in the middle, turn them into underscores (_).
  4. Add a four-digit number and a hyphen in front of the name. Start the counter at 1.
  5. Print each file name on a new line.

Example input:

preview.EXE;Bali.jpg; important list.doc

Expected output:

0001-preview.exe
0002-bali.jpg
0003-important_list.doc

Stuck? Here's a hint!

Use the split(), strip(), lower(), replace(), and format() functions.