Me three. This glitch happened to me three times in a row now.
Test your crap Game Freak!
Edit: Just beat and caught it. Not S-Ranking that until they fix it.
Edit 2: Anyone figure out the one move trick in 179?
Edit 3: One move left gave an S-Rank. Huh...
I think S-rank is half the number of stages rounded down. So a three stage Pokemon would give you S rank at 2 or 1 remaining.
I hate that this is one of my most played 3DS games.