(defun main (&rest argv) (declare (ignorable argv)) (let* ((g (read)) (c (read)) (p (read)) (s (read-line)) (gg (count #\G s)) (cc (count #\C s)) (pp (count #\P s)) (ggg 0) (ccc 0) (ppp 0) (res (* 3 (+ (min g cc) (min c pp) (min p gg))))) (setf ggg (- g (min g cc)) cc (- cc (min g cc)) ccc (- c (min c pp)) pp (- pp (min c pp)) ppp (- p (min p gg)) gg (- gg (min p gg))) (incf res (+ (min ggg gg) (min ccc cc) (min ppp pp))) (format t "~d~%" res))) (main)