Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleTests
- {
- class ConsoleTests
- {
- static void Main()
- {
- string text = Console.ReadLine();
- Console.WriteLine(ReverseWords(text));
- }
- public static string ReverseWords(string sentence)
- {
- char[] separators = new char[2]{' ','.'};
- string[] words = sentence.Split(separators);
- Array.Reverse(words);
- return string.Join(" ", words);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment