Question: even / odd / substring: x in { a , b } x has an even number of a s , or x has an

even/odd/substring:
x in {a, b} x has an even number of as, or x has an odd number of bs, or
x contains both the substrings babb and aabaa
first appears more:
{x in {0,1}||x|>=3 and the first symbol of x appears at least three times total in x}
repeat near end: {x in {0,1}| x[|x|5]= x[|x|3]}
Assume we start indexing at 1, so that x[|x|] is the last symbol in x, and x[1] is the first.
email: {x in \Sigma | x is a syntactically valid email address}
Definition of syntactically valid email address: Let \Sigma ={., @, a, b } contain the
alphabetic symbols a and b,1 as well as the symbols for period . and at @. Syntactically
valid emails are of the form username@host.domain where username and host are nonempty
and may contain alphabetic symbols or ., but never two .s in a row, nor can either of them
begin or end with a ., and domain must be of length 2 or 3 and contain only alphabetic
symbols. For example, aaba@aaabb.aba and ab.ba@ab.abb.ba are valid email addresses,
but aaabb.aba is not (no @ symbol), nor is .ba@ab.abb.ba (username starts with a .), nor is
1Its not that hard to make a regex that actually uses the full alphanumeric alphabet here, but historically weve
found that many students solutions are correct but use so many subexpressions that they crash the simulator. Using
only two alphabetic symbols a and b reduces this problem, even though it makes the examples more artificial-looking.
2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!