       Set of strings reducing problem

• To: mathgroup at smc.vnet.net
• Subject: [mg58560] Set of strings reducing problem
• From: "Edson Ferreira" <edsferr at uol.com.br>
• Date: Thu, 7 Jul 2005 05:35:50 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```Dear Mathematica Users,

I have a problem that I haven't got any clue to solve with Mathematica.

Let's say a have a list of "n" equal length strings:

L={"11111111",
"11112111",
"1111X111",
...
...
...
"21122211"}

The characters used in strings are only "1", "X", "2", "U", "M", "D" and
"T".

What I want is a reduced set of strings (with all the resulting strings
with the same length as all the original ones).

The rule to "join" two strings is the following:

If one string is different from the other by just one character then
take the characters that are different and apply the rule bellow:

"1" + "X" = "D"
"1" + "2" = "M"
"1" + "U" = "T"
"X" + "2" = "U"
"X" + "M" = "T"
"2" + "D" = "T"

For example, suppose I have these two elements in the list : "11112111"
and "1111X111"

The rule will transform these two strings into one : "1111U111"

After all the possible transformations (always using two strings with
only one different character and resulting another string) I will obtain
a reduced set of strings.

How can I do that with mathematica??

I guess the first step is a function to identify is two strings are
different by just one ccharacter.
A loop then search in the set for any ocurrences of that and apply all
possible transformations until we can't get any redution.

Thanks in advance for any help!!!!!

Edson

edsferr at uol.com.br

```

• Prev by Date: combinations problem
• Next by Date: Re: Simplify and FullSimplify
• Previous by thread: Re: combinations problem
• Next by thread: Re: Set of strings reducing problem