Length of Worm

Published by Matt in

Given a string worm create a function that takes the length of the worm and converts it into millimeters. Each - represents one centimeter.

Examples

wormLength("----------") ➞ "100 mm."

wormLength("") ➞ "invalid"

wormLength("---_-___---_") ➞ "invalid"

Notes

Return "invalid" if an empty string is given or if the string has characters other than -.

Watch a quick demo on how Edabit works.