Estoy tratando de invertir el orden de las palabras en una oración manteniendo los espacios como a continuación.Inversión de cadena en C++
[this is my test string] ==> [string test my is this]
lo hice en una manera paso a paso como,
[this is my test string] - input string
[gnirts tset ym si siht] - reverse the whole string - in-place
[string test my is this] - reverse the words of the string - in-place
[string test my is this] - string-2 with spaces rearranged
¿Hay algún otro método para hacer esto? ¿También es posible hacer el último paso en el lugar?
Me gustaría saber la lógica de negocio detrás de esto ... – jcolebrand
@drachenstern Bueno, puede necesita algoritmos similares cuando se renderiza texto bidi. – ybungalobill
¿Qué quiere decir con su "¿También es posible dar el último paso en el lugar"? Lo que tienes ya está haciendo todo en el lugar. ¿De qué "último paso" estás hablando? – AnT