Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
vigenere cypher
//Rextester.Program.Main is the entry point for your code. Don't change it. //Microsoft (R) Visual C# Compiler version 2.9.0.63208 (958f2354) using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { static int mod(int a,int b) { int abs = a < 0 ? -a:a; return a < 0? b - abs:(a > b? a - b:a); } public static void Main(string[] args) { int lc = 'a'; string key = Console.ReadLine().ToLower();//line 0 of input string txt = Console.ReadLine().ToLower();//line 1 of input /*{ string pr = txt; do{pr = Console.ReadLine();txt += '\n' + (pr != "" ? pr:"");}while (pr != ""); }*/ int ind = 0; foreach(char c in txt) { int ke = key[ind] - lc; int ch = mod(ke - (c - lc),26); if (char.IsLetter(c)){Console.Write((char)(ch + lc)); ind ++;}else{Console.Write(c);} ind = ind % key.Length; } } } }
run
|
edit
|
history
|
help
2
lasses, properties, methods, ling begining
Generic Reference constraint
Truncate String by Byte
Ex03 cm=ft,in
Best Exam Collection site
CommandForce1
regex
Intuit // C# // Lecture_4 // Laba_#2
Math 10.9 edited makeMultQ
enum flag comparison