+ 1
How can I get ordered, duplicate vowel based maximum possible variations of words/strings?
For example: Maalaviiy-> Malaviiy, Maalaviy, Malaviy Maahaarathii-> mahaarathii, maaharathii, maahaarathi, maharathii, maaharathi, mahaarathi
7 ответов
+ 2
Satyam Dwivedi, I sketched code on python.
This way based on recursive construction of all possible variations with repetitions from 2 to N where N is identical vowel sequences amount (with length > 1).
For example, word "Maahaarathii" corresponds to this variations from 2 (0, 1) to 3 (aa, aa, ii):
000, 001, 010, 011, 100, 101, 110, 111.
0 means that we do not change the corresponding vowel sequence,
1 means shorten to one vowel
000 => Maahaarathii, 111 => Maharathi, 010 => Maaharathii etc.
Total 2^N combinations.
https://code.sololearn.com/c4cundENvp95/?ref=app
+ 3
I don't get it.
+ 2
Daniel Holmes How does 'Maalaviiy' become 'Malviiy' and why does the same pattern not apply to 'Maahaarathi'? The second example doesn't "lose" any vowels 🤔
0
Anna, i think that autor just missed one letter. Not Malviiy, Malaviiy.
And autor considered not all cases.
0
I don't know Russian, but спасибо I guess
0
Daniel Holmes you pointed out correctly, I missed 'a' in all Maalaviiy examples which I have corrected now.
Thankyou so much for your interest guys
In case you didn't notice, the common pattern between all these examples is the deletion of the consecutive duplicate vowel at a time to form the maximum possible combinations of the string and the rest of the string remains the same. Single characters remain intact, the change occurs only in the consecutive duplicate characters.
Other example can be such as:
raam-> ram
paapii-> papii, paapi, papi
maanushiikaa-> manushiikaa, maanushikaa, maanushiika, manushikaa, maanushika,
manushiika
0
Daniel Holmes It's working perfectly dear. Thankyou so much.
Can you please modify it so that it may take a .csv file with one string in each line as an input and output the variations separated by a tab next to each string in form of a .csv file.
Thanks