Декодирование текста в приведенном коде работает некорректно - C#
Формулировка задачи:
в конце не печатает s1
я только учусь , помогите плиз
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace poxarinum
{
class Program
{
static void Main(string[] args)
{
string s;
bool f = false;
string text;
Console.Write("введите текст для декодирования: ");
s = Console.ReadLine();//nermucum enq gaxtnagrvox text@
Console.Write("введите ключ: ");
text = Console.ReadLine();// nermucum enq banalin
text = text.Replace(" ", "");
text = text.ToUpper();
text = new string(text.Distinct().ToArray());// heracnum enq krknvox tarer@
s = s.Replace(" ", "");
for (char i = 'a'; i <= 'z'; i++)
{
if (text.Contains(i) == f)
text = text + i;
}
text = text.Replace(" ", "");
text = text.ToUpper();
text = new string(text.Distinct().ToArray());// heracnum enq krknvox tarer@
string alf = "";
for (char i = 'a'; i <= 'z';i++ )
if (alf.Contains(i) == f)
alf = alf + i;
//string alf = "abcdefghijklmnopqrstuvwxyz";
String s1 = "";
for (int i = 0; i < s.Length; i++)
for (int j = 0; j < text.Length; j++)
{
if (s[i] == text[j])
s1 = s1 + alf[j];
}
Console.WriteLine("декодированный текст будет: " + s1);
Console.ReadLine();
}
}
}Решение задачи: «Декодирование текста в приведенном коде работает некорректно»
textual
Листинг программы
text = text.ToUpper();