My doubles pickleball group often has five people. Four are playing and one is awaiting the next game. We can represent the state of the game with a string of five characters like abCde. This indicates that a and b are playing against c and d with c serving. We want to write a routine that gives the possible positions after the next rally is complete. The examples below will assume we start with this configuration.
For those unfamiliar with the game, two players are paired to play against the other two. One of the players serves to put the ball in play. A rally consists of play until one side fails to hit the ball back legally, at which point it is won by the side that did not fail. Only the serving side scores points for winning a rally. The receiving side only moves the serve along by winning a rally.
There are four possible outcomes of a rally.
The serving side wins the rally but does not win the game. The players on the serving side change places and the same player serves, so we go to abdCe.
The serving side wins the rally and thereby wins the game. The players rotate one position right and the serve goes to the first position, so we go to Eabcd
The receiving side wins the rally, but the partner of the server has not served yet. The players stay in position and the serve goes to the partner, so we go to abcDe
The receiving side wins the rally and the partner of the server has served. The players stay in position and the serve goes to the first player of the other side, the one in first or third position. Here we go to Abcde
Your task is to write a routine that takes a configuration at the start of a rally and returns or prints the four possible configurations at the end of the rally in the order of the possibilities above. A configuration has the five characters in any order with the server any of the first four. This is code golf, so the shortest solution wins. You can use other characters and other ways of indicating the server if you wish, like digits and making the server negative or adding $5$ to the server or putting an asterisk after the server. There needs to be a clear break between the four possibilities, like a space, a newline, or separate elements of a list. You can take your input in any convenient way, as a string or array for example. The characters used should be the same on input and output.
Test cases-input first column, output the remaining four
Abcde bAcde Eabcd aBcde abCde
caBed caeBd Dcabe cabEd Cabed
dBace Bdace Edbac Dbace dbAce
bcdAe bcAde Ebcda bcDae Bcdae