reverse the string without reversing the space using python programming
Answers
Answered by
0
import java. util. Stack;
public static String reverse(String s)
int low = 0, high = 0;
Stack<String> stack = new Stack();
for (int i = 0; i < s. length(); i++)
if (s. char At(i) == ' ')
stack. push(s. substring (low, high + 1));
low = high = i + 1;
Similar questions