svephoto

Reverse Strings [C#]

Aug 23rd, 2021 (edited)
456
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.48 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace ReverseStrings
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             string input = Console.ReadLine();
  11.  
  12.             Stack<string> reversed = new Stack<string>();
  13.  
  14.             for (int i = 0; i < input.Length; i++)
  15.             {
  16.                 reversed.Push(String.Format($"{input[i]}"));
  17.             }
  18.  
  19.             Console.WriteLine(String.Join("", reversed));
  20.         }
  21.     }
  22. }
  23.  
Add Comment
Please, Sign In to add comment