using System; using System.Collections.Generic; using System.Linq; class Program { static string InputPattern = "InputX"; static List GetInputList() { var WillReturn = new List(); if (InputPattern == "Input1") { WillReturn.Add("BCD"); //AAA } else if (InputPattern == "Input2") { WillReturn.Add("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); //ZZZZZZZZZZZZZZZZZZZZZZZZZZ } else if (InputPattern == "Input3") { WillReturn.Add(new string('Z', 104)); //YXWVUTSRQPONMLKJIHGFEDCBAZYXWVUTSRQPONMLKJIHGFEDCB //AZYXWVUTSRQPONMLKJIHGFEDCBAZYXWVUTSRQPONMLKJIHGFED //CBAZ } else { string wkStr; while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr); } return WillReturn; } static void Main() { List InputList = GetInputList(); string S = InputList[0]; var sb = new System.Text.StringBuilder(); for (int I = 0; I <= S.Length - 1; I++) { sb.Append(ZurashiSyori(S[I], I + 1)); } Console.WriteLine(sb.ToString()); } //対象文字を、指定文字分ずらす static char ZurashiSyori(char pTarget, int pN) { while (27 <= pN) pN -= 26; char wkChar = (char)(pTarget - pN); if ('A' <= wkChar) return wkChar; return (char)('Z' - ('A' - wkChar - 1)); } }