Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2021
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5.  
  6. namespace ReverseString
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. string[] input = Console.ReadLine().Split();
  13.  
  14. Stack<string> reversed = new Stack<string>();
  15.  
  16. for (int i = 0; i < input.Length; i++)
  17. {
  18. string word = "";
  19. for (int j = input[i].Length - 1; j >= 0; j--)
  20. {
  21. word += input[i][j];
  22. }
  23.  
  24. reversed.Push(word);
  25. }
  26.  
  27. Console.WriteLine(String.Join(" ", reversed));
  28. }
  29. }
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement