Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace ConsoleApp1
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine();
- string[] words = input
- .Split(new[] { '.', ',', '!', '?', '-', ' ' }, StringSplitOptions.RemoveEmptyEntries);
- Stack<string> reversedSentence = new Stack<string>();
- foreach (var item in words)
- {
- reversedSentence.Push(item);
- }
- while (reversedSentence.Count>0)
- {
- Console.WriteLine(reversedSentence.Pop());
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement