rank st we n = if length pAndR < n then "Not enough participants" else fst . (!!(n-1)) . sortBy cmp $ pAndR
    where pAndR = zipWith (\w name -> (name, w * (length name + (sum . map (\c -> (ord . toUpper $ c) - ord 'A' + 1) $ name)))) we . split (dropDelims $ oneOf ",") $ st
          cmp (name1, rank1) (name2, rank2) = case compare rank2 rank1 of
              EQ -> compare name1 name2
              o1 -> o1
rank st we n = if length pAndR < n then "Not enough participants" else fst . (!!(n-1)) . sortBy cmp $ pAndR
    where pAndR = zipWith (\w name -> (name, w * (length name + (sum . map (\c -> (ord . toUpper $ c) - ord 'A' + 1) $ name)))) we . split (dropDelims $ oneOf ",") $ st
          cmp (name1, rank1) (name2, rank2) = case compare rank2 rank1 of
              EQ -> compare name1 name2
              o1 -> o1
rank st we n = if length pAndR < n then "Not enough participants" else fst . (!!(n-1)) . sortBy cmp $ pAndR
    where pAndR = zipWith (\w name -> (name, w * (length name + (sum . map (\c -> (ord . toUpper $ c) - ord 'A' + 1) $ name)))) we . split (dropDelims $ oneOf ",") $ st
          cmp (name1, rank1) (name2, rank2) = case compare rank2 rank1 of
              EQ -> compare name1 name2
              o1 -> o1