[SUBS]RANK

Problem 251 - a classic!