From: "Dmitry S. Kravtsov" Date: 2012-04-28T21:36:36+09:00 Subject: Re: matching substrings --047d7b10cb7956fa6304bebc788f Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I also against solving someones homework, but I'll give you maybe a helpful advice. You should look at algorithms, that solve Largest Common Subsequence problem. Here the sequences are arrays of consecutive length 2 substrings. For instance "abcde" should be represented with sequence ["ab", "bc", "cd", "de"]. The rest is up to you :) 26 =D0=B0=D0=BF=D1=80=D0=B5=D0=BB=D1=8F 2012 =D0=B3. 6:48 =D0=BF=D0=BE=D0= =BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Clay Tzoucalis =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB: > I need a little help with an assignment. Following is the code I am > being asked to create, any help with this would be great. > > Ask the user to enter two strings, a and b. Then return the number of > positions where they contain the same length 2 substring. So =E2=80=9Cxxc= aazz=E2=80=9D > and =E2=80=9Cxxbaaz=E2=80=9D yields 3, since the =E2=80=9Cxx=E2=80=9D, = =E2=80=9Caa=E2=80=9D, and =E2=80=9Caz=E2=80=9D substrings appear > in the same place in both strings. > > string_match('xxcaazz', 'xxbaaz') =E2=86=92 3 > string_match('abc', 'abc') =E2=86=92 2 > string_match('abc', 'axc') =E2=86=92 0 > > -- > Posted via http://www.ruby-forum.com/. > --=20 Dmitry S. Kravtsov --047d7b10cb7956fa6304bebc788f Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I also against solving someones homework, but I&= #39;ll give you maybe a helpful advice.
You= should look at algorithms, that solve Largest Common Subsequence problem. = Here the sequences
are arrays of consecutive length 2 substrings. F= or instance "abcde" should be represented with sequence
["ab", "bc", "cd", &qu= ot;de"]. The rest is up to you :)

26 =D0=B0=D0=BF= =D1=80=D0=B5=D0=BB=D1=8F 2012=C2=A0=D0=B3. 6:48 =D0=BF=D0=BE=D0=BB=D1=8C=D0= =B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Clay Tzoucalis <lists@rub= y-forum.com> =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
I need a little help with an assignment. Fol= lowing is the code I am
being asked to create, any help with this would be great.

Ask the user to enter two strings, a and b. Then return the number of
positions where they contain the same length 2 substring. So =E2=80=9Cxxcaa= zz=E2=80=9D
and =E2=80=9Cxxbaaz=E2=80=9D yields 3, since the =E2=80=9Cxx=E2=80=9D, =E2= =80=9Caa=E2=80=9D, and =E2=80=9Caz=E2=80=9D substrings appear
in the same place in both strings.

string_match('xxcaazz', 'xxbaaz') =E2=86=92 3
string_match('abc', 'abc') =E2=86=92 2
string_match('abc', 'axc') =E2=86=92 0

--
Posted via http://= www.ruby-forum.com/.



-- Dmitry S. Kravtsov
--047d7b10cb7956fa6304bebc788f--