Computer Science, asked by prempasupuleti9999, 3 months ago

Problem statement
Implement the following function:
char* MoveHyphen(char str[], int n);
The function accepts a string 'str' of length 'n', that contains alphabets and hyphens (-). Implement the function to move all hyphens (-) in the
string to the front of the given string.
Note: Return null (None in case of python) if str is empty.
29-318N24
Example:
Input:
str: Move-Hyphens-to-Front
Output:
---MoveHyphenstoFront
Explanation:
The string "Move-Hyphens-to-Front" has 3 hyphens (-), which are moved to the front of the string, thus output is "---MoveHyphenstoFront".
Sample Input
str: String-Compare
Sample Output
-String Compare​

Answers

Answered by Anonymous
0

Answer:

---MoveHyphenstoFront

Explanation:

The string "Move-Hyphens-to-Front" has 3 hyphens (-), which are moved to the front of the string, thus output is "---MoveHyphenstoFront".

Sample Input

str: String-Compare

Sample Output

-String Compare

Similar questions