Arrange W, D, and L Results into Repeated WDL Groups

Given a string s consisting only of W, D, and L (win, draw, and loss), rearrange its characters as follows:

  1. While at least one W, one D, and one L remain, append WDL to the result....

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: