length of a string
Suppose we have a string on alphabet . We can then representthe string as , where for all (), (this means that each mustbe a “letter” from the alphabet). Then, the length of is . Thelength of a string is represented as .
For example, if our alphabet is then the length of the string is , sincethe string breaks down as follows: , , , .So, our is and therefore . Although you may think that is two separate symbols, our chosen alphabet in fact classifies it asa single symbol.
A “special case” occurs when , i.e. it does not have any symbolsin it. This string is called the empty string. Instead of saying, we use to represent the empty string:. This is similar to the practice of using to represent a space, even though a space is really blank.
If your alphabet contains as a symbol, thenyou must use something else to denote the empty string.
Suppose you also have a string on the same alphabet as . We turn into just as before, and similarly .We say is equal to if and only if both , andfor every , .
For example, suppose and , both strings on alphabet .These strings are not equal because the second symbols do not match.