Valarmathi

Valarmathi

  • NA
  • 37
  • 11.3k

Reverse the odd words using c# [URGENT PLEASE]

Aug 24 2015 11:43 AM
Consider a character array consisting of letters, a space, and a period. Words consist of one or more, but at most 15 letters.
 
 
 

An input text consists of one or more words separated from each other by one or more spaces and terminated more spaces followed by a point. Input should be read from, and including, the first letter of the first word, up to and including the terminating point.

The output text is to be produced such that successive words are separated by a single space with the last word being terminated by a single point. Odd words are copied in reverse order while even words are kept as it is.

For example, the input string

: get busy living or get busy dying.

becomes

: get ysub living ro get ysub dying.

 

Answers (4)