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 Input
- {
- class Program
- {
- static void Main(string[] args)
- {
- int step, word;
- string text, key, result = string.Empty;
- Console.Write("Enter Text : ");
- text = Console.ReadLine();
- Console.Write("Enter Key : ");
- key = Console.ReadLine();
- Console.Write("Enter Step : ");
- step = int.Parse(Console.ReadLine());
- // MIX STRING
- word = 0;
- if (step <= text.Length)
- {
- for (int i = 0; i < key.Length; i++)
- {
- result += key.Substring(i, 1);
- for (int k = 0; k < step; k++)
- {
- try
- {
- result += text.Substring(word, 1);
- word++;
- }
- catch
- {
- break;
- }
- }
- }
- if (word < text.Length)
- {
- result += text.Substring(word, (text.Length - word));
- }
- }
- Console.WriteLine("Result Text : " + result);
- // DECIPHER STRING
- Console.WriteLine("text: " + text);
- Console.WriteLine("key: " + key);
- Console.ReadKey();
- }
- }
- }
Add Comment
Please, Sign In to add comment