Author Topic: NDA  (Read 5461 times)

Offline sep

  • Jr. Linguist
  • **
  • Posts: 5
« on: April 04, 2016, 04:13:09 PM »
This is what I think so far, is that correct? Please help.

Design a non-deterministic automaton and regular expression over the alphabet {a, b, c} that accept all and only those strings that contain exactly three a's, three b's, or three c's, not necessarily consecutively. Strings in this language include:{aaa, abaab, abbcccccccccccbaaa,cbccbbbbbbb,...} . Also, design a regular expression for this language.

As a regular expression I think it would be like [bc]*a[bc]*a[bc]*a[bc]* but I'm not sure.

For an NDA, it would be like :

Offline freknu

  • Forum Regulars
  • Serious Linguist
  • *
  • Posts: 396
  • Country: fi
    • Ostrobothnian (Norse)
« Reply #1 on: April 06, 2016, 01:14:44 AM »
I wouldn't know about the NDA, but when it comes to the regular expression the easiest way is to solve the expression for only one character first.

How do you find the strings that contain exactly three a's?

Your current expression will not match strings that contain 3 b's or 3 c's, if it does not also contain 3 a's. is a good tool to quickly test regular expressions, as long as you remember that it uses the JavaScript dialect.