n
= 4, thus
|
x
| = 4
Definition:
Let
x
be
a
string
over
S
.
The
length
of
x
,
|
x
|
, is defined as follows:
1)
if
x
=
e
,
then
|
x
|
= 0
2)
if
x
=
a
1
…
a
n
,
then
|
x
|
=
n
for some
n
³
1, and
a
i
Î
S
for all
i
= 1,…,
n
Note:
The length of
x
is the number of all symbols in
x
.
Example:
Consider
x
=1010
Task:
|
x
|
x
= 1 0 1 0
a
1
a
2
a
3
a
4
Length of String
Gist: |
a
1
a
2
…
a
n
| =
n
4/20