procedure TForm1.Button2Click(Sender: TObject);
const
rusalf=['а','б','в','г','д','е','ё','ж','з','и','й','к','л','м','н','о','п','р','с','т','у','ф','х','ц','ч','ш','щ','ь','ы','ъ','э','
ю','я',' '];
angalf=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','r','s','t','u','v','w','x','y','z',' ','q'];
var
ch:real;
i,j:integer;
masr: array [1..33] of string;
masc: array [1..33] of real;
masa: array [1..27] of string;
masac: array [1..27] of real;
masn: array [1..27] of real;
masf: array [1..27] of real;
begin
ch:=0;
{======= Русский алфавит =======}
masr[1]:='а'; masc[1]:=0.064; masr[18]:='с'; masc[18]:=0.045;
masr[2]:='б'; masc[2]:=0.014; masr[19]:='т'; masc[19]:=0.053;
masr[3]:='в'; masc[3]:=0.038; masr[20]:='у'; masc[20]:=0.021;
masr[4]:='г'; masc[4]:=0.012; masr[21]:='ф'; masc[21]:=0.002;
masr[5]:='д'; masc[5]:=0.025; masr[22]:='х'; masc[22]:=0.009;
masr[6]:='е'; masc[6]:=0.072; masr[23]:='ц'; masc[23]:=0.004;
masr[7]:='ё'; masc[7]:=0.072; masr[24]:='ч'; masc[24]:=0.012;
masr[8]:='ж'; masc[8]:=0.007; masr[25]:='ш'; masc[25]:=0.006;
masr[9]:='и'; masc[9]:=0.062; masr[26]:='щ'; masc[26]:=0.003;
masr[10]:='й'; masc[10]:=0.010; masr[27]:='ь'; masc[27]:=0.014;
masr[11]:='к'; masc[11]:=0.028; masr[28]:='ы'; masc[28]:=0.016;
masr[12]:='л'; masc[12]:=0.035; masr[29]:='ъ'; masc[29]:=0.014;
masr[13]:='м'; masc[13]:=0.026; masr[30]:='э'; masc[30]:=0.003;
masr[14]:='н'; masc[14]:=0.053; masr[31]:='ю'; masc[31]:=0.006;
masr[15]:='о'; masc[15]:=0.090; masr[32]:='я'; masc[32]:=0.018;
masr[16]:='п'; masc[16]:=0.023; masr[33]:=' '; masc[33]:=0.175;
masr[17]:='р'; masc[17]:=0.040;
{======= Английский алфавит =======}
masa[1]:='a'; masac[1]:=0.081; masa[14]:='n'; masac[14]:=0.072;
masa[2]:='b'; masac[2]:=0.014; masa[15]:='o'; masac[15]:=0.029;
masa[3]:='c'; masac[3]:=0.027; masa[16]:='p'; masac[16]:=0.020;
masa[4]:='d'; masac[4]:=0.039; masa[17]:='r'; masac[17]:=0.069;
masa[5]:='e'; masac[5]:=0.130; masa[18]:='s'; masac[18]:=0.061;
masa[6]:='f'; masac[6]:=0.129; masa[19]:='t'; masac[19]:=0.015;
masa[7]:='g'; masac[7]:=0.020; masa[20]:='u'; masac[20]:=0.024;
masa[8]:='h'; masac[8]:=0.052; masa[21]:='v'; masac[21]:=0.009;
masa[9]:='i'; masac[9]:=0.062; masa[22]:='w'; masac[22]:=0.015;
masa[10]:='j'; masac[10]:=0.002; masa[23]:='x'; masac[23]:=0.002;
masa[11]:='k'; masac[11]:=0.004; masa[24]:='y'; masac[24]:=0.019;
masa[12]:='l'; masac[12]:=0.034; masa[25]:='z'; masac[25]:=0.001;
masa[13]:='m'; masac[13]:=0.025; masa[26]:=' '; masac[26]:=0.175;
masa[27]:='q'; masac[27]:=0.052;
masn[1]:=0.129; masn[14]:=0.062; masf[1]:=0.076; masf[14]:=0.076;