finished the rankC function in exercise 1