Problem with the test case. Exact answer but the solution does not get accepted


#1

The question clearly mentions no leading or trailing spaces but the test case contains a leading space which gives an error for the submission.


#2

I am also facing same issue. did you find any solution ?


#3

condition 1. >> remove extra space (use trim() in java)

condition 2. >> do not add space after the last element or (once you completed the reversing string then trim() again)


#4

image