[Examples]: Modified examples to use ToStringFunction

Modified the examples to use the ToStringFunction class, and separate
their fitness functions from their ToString functions.

Signed-off-by: Sebastian Lenartowicz <slenarto@uoguelph.ca>