String reversal in C++

I am trying to reverse the order of words in a sentence by maintaining the spaces as below. [this is my test string] ==> [string test my is this] I did in a step by step manner as, [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 Is there any other method to do this ? Is it also possible to do the last step in-place ?
I would love to know the business logic behind this ...

以上就是String reversal in C++的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » CSS3 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准