Finished printByChar function