hw5 solution

also implement to_string instance representation