A
A
Andrey382875122019-11-06 08:52:54
Programming
Andrey38287512, 2019-11-06 08:52:54

Need to split a string into multiple substrings?

I have Morse code --. . .-.-..-....-..-.---.-.-....- --. . .-.-... but there are no spaces in it I need to make all variants of string sections How to do it in cycles? or even how to do it?
For example, there is a line .-. here are the options for breaking it:
.- .
. - .
. -.
I need to make a program that will do this automatically!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
whiteblackness, 2019-11-06
@Andrey38287512

In the general case, this cannot be done, because without spaces it is impossible to unambiguously split into letters.
For example
vg · − − − − ·
yn · − − − − ·
Combinations of two letters give the same sequence.
Alternatively, you can have a dictionary of words, and try to find all the options and match them with words from the dictionary.
+ you can take into account the probability of meeting certain combinations of letters

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question