Menu

1 / 2

Weekly Challenge: Vowels and numbers

DEV Community: perl·Simon Green·6 months ago
#LBJv3ZJS
#dev#solution#substr#input_string#article
Reading 0:00
15s threshold

Weekly Challenge 374

Each week Mohammad S. Anwar sends out The Weekly Challenge , a chance for all of us to come up with solutions to two weekly tasks. My solutions are written in Python first, and then converted to Perl. Unless otherwise stated, Copilot (and other AI tools) have NOT been used to generate the solution. It's a great way for us all to practice some coding.

Challenge , My solutions

Task 1: Count Vowel

Task

You are given a string.

Write a script to return all possible vowel substrings in the given string. A vowel substring is a substring that only consists of vowels and has all five vowels present in it.

My solution

It seems many Team PWC users sent Mohammad "so many emails" when the examples did not match the expected output. As I follow TDD when completing the challenges, I also picked this up.

For this task, I have two loops to generate all possible substrings. The variable start goes from 0 to 5 less than the length of the string.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.