Move hyphens to the front
Move every hyphen (-) to the front of the string, keeping all other characters in their original order.
Reported in: Accenture (Aug 2021) (memory-based)
Input
One line: the string.
Output
The new string.
Constraints
1 ≤ length ≤ 10^5.
Example 1
Input:
Move-Hyphens-to-Front
Output:
---MoveHyphenstoFrontExample 2
Input:
no-dash-
Output:
--nodashHint: Count the hyphens, then append the remaining characters in order.