pull out solving loop in main and put into function
move Char class to header file