Remove all the consonants in the given phrase.
Input s1 = 'Jack and Jill went up the hill';
Output s2 is 'a a i e u e i';
I agree with the comments below, the test suite does not match the problem description.
Fixing and rescoring. Sorry about the confusion.
Though I think technically the problem description is correct, it would be much more understandable if you show what to do with punctuation as well.
Also, from the example it is not clear what one should do if two vowels exists in one word. Since it is not asked in the test-suite, maybe note explicitly that you can assume that every word will have one vowel at the most.
In the answer, spaces separate remaining characters except when preceeding punctuation!
I keep getting "There was an issue submitting your solution. Remove inappropriate content." No idea why.
This is just a "corollary" to the problem of removing vowels (with the same sample sentence!)
Brian Butler the spaces in the original sentence were included in the new sentence. It just seems the way you said it due to there being one vowel per word in the original.
I after 500 like i gave up but could distinguish between the two, I just wrote if and else and typed the thing. That counts right. XD I have no clue. lol I turned them into a double into a double figured out ' = 39 , space = 32 . = 46, It started Numbers = double(s1); Then I made vow = double(['AaEeIiOoUu.','''']) nothing wrong with that stuff. First one easy. The periods and little squirt marks in the second one. DX so stuck. Should I break it in two at the squirts and just make 2 strings. That's what I am thinking. It seem to have a mind of its own in the current form. It is just the spaces.
More test cases could be added as well. Such as if the sentence includes numbers, whitespaces, e.t.c.
i hate this problem
After executing the the input string
s1 = 'I don''t want to work. I just want to bang on the drum all day.'
it is reading as single quote at "don''t " word but in the result both quotes are shown how it is possible????
The vowels to retain here are, 'a e i o u'. There appears to be confusion for some.
function s2 = refcn(s1)
Y is no consonnant to me, but ok
Should clarify that 'y' is treated as a consonant.
It seems to be a mistake - in the second test S1 includes 'y' .That is not consonant, but the output S2 has not it.
tai tama nan le:)
wo hao nan a
y is a vowel !
Why are there 2 apostrophes in answer of 2nd test?
Because if you do not double up (''), the single apostrophe is read by MATLAB as the end of the character vector. This is how you get around this.
take me some time to do ...
doc regexprep :'(?=[a-z])[^aeiou]' matches consonants.
I think is the best solution!
Hi, I really like your solution.much easier than mine
this solution just pass the test suite, but if there would be uppercase consonants, will fail!
The variable letter must contain the uppercase consonants too!
s1 = 'Jack and Jill went up the hill';
s2 = 'a a i e u e i';
a =  n = 30 s2 =  a = 'a' s2 = 'a' s2 = 'a' s2 = 'a' s2 = 'a' a = 'aa' s2 = 'aa' s2 = 'aa' s2 = 'aa' s2 = 'aa' s2 = 'aa' a = 'aai' s2 = 'aai' s2 = 'aai' s2 = 'aai' s2 = 'aai' s2 = 'aai' a = 'aaie' s2 = 'aaie' s2 = 'aaie' s2 = 'aaie' s2 = 'aaie' a = 'aaieu' s2 = 'aaieu' s2 = 'aaieu' s2 = 'aaieu' s2 = 'aaieu' s2 = 'aaieu' a = 'aaieue' s2 = 'aaieue' s2 = 'aaieue' s2 = 'aaieue' a = 'aaieuei' s2 = 'aaieuei' s2 = 'aaieuei' s2 = 'aaieuei'
explain me why it doesn't work?
Two things: (1) "y" is not normally considered a vowel, in everyday contexts; (2) you are omitting the spaces shown in s2 in the target solutions.
and y in test 2
can anyone help me solve this problem.
function ans = refcn(s1)
regexprep(s1,'(?=[a-z])[^aeiou]', ' ','preservecase');
not working help me
write like this
Raihan Ahmed, I know this comment is years old, but could you explain how the input '(?![aeiou])[a-z]' works? Obviously, MatLab recognises it as the same thing as '[b,c,d,f,g,h,j,k,l,m,n,p,q,r,s,t,v,w,x,y,z]', but what exactly is it doing?
It looks like the test suit was modified and former solutions that were working are not working anymore.. so we are not competing on the same playground with new solutions..
the solution is not very pretty, try regular expressions
s1 = 'I don''t want to work. I just want to bang on the drum all day.';
the second case seems does not fit the meaning of the qustion! and l think it is totally unnecessary
lol y ^^
Generally "y" is not considered a consonant
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office