Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace triple_rotation
- {
- class TripleRotation
- {
- static void Main(string[] args)
- {
- string getInput = Console.ReadLine();
- int K = int.Parse(getInput);
- int getInputLen = getInput.Length;
- if (getInputLen > 2)
- {
- string[] getLastChars = new string[3];
- string finalString = "";
- for (int i = getInput.Length - 1, j = 0; i >= getInput.Length - 3; i--, j++)
- {
- getLastChars[j] = getInput[i].ToString();
- }
- for (int i = 2; i >= 0; i--)
- {
- if (getLastChars[i] == "0")
- {
- finalString += "";
- }
- else
- {
- finalString += getLastChars[i];
- }
- }
- string removeLast = getInput.Remove(getInput.Length - 3);
- finalString = finalString + removeLast;
- Console.WriteLine(finalString);
- }
- else if (getInputLen == 2)
- {
- string removeLast = getInput.Remove(getInput.Length - 1);
- char last = getInput[getInput.Length - 1];
- Console.WriteLine(last + removeLast);
- }
- else
- {
- Console.WriteLine(getInput);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement