The book code would uniquely identify a book in a book catalog. The book code is a ten digits value, where the first nine digits must be decimal digits (0...9), and the tenth can be either a decimal digit or the letter X. Three single dashes may be between any of the characters. (That is, a book code may either have no dashes or exactly three dashes). Also, a book code must not begin or end with a dash.
What is a good way to start this?
Some examples of valid book codes are:
0-201-88337-6
0-13-117334-0
0821211315 (no dashes is ok)
1-57231-866-X
Some invalid book codes are:
0-201-8A337-6 (bad digit)
0-201-88337-63 (too many digits)
0-201-88-337-6 (too many dashes)
0-201883376 (not enough dashes)
-013-117334-0 (beginning or ending dash)
157231--866-X (sequential dashes)
013-1134-0 (too few digits)
I just dont know where to start.
Thanks