program Project2; {$APPTYPE CONSOLE} uses SysUtils; var i,x,y,z, dwa,tri,shetire,pati:Integer; begin Writeln('student Fediya='); Readln(i); Writeln('student Sungat='); readln(x); Writeln('student Alex='); readln(y); Writeln('student Halif='); Readln(z); case i of 2: Inc(dwa); 3: Inc(tri); 4: Inc(shetire); 5: Inc(pati); end; begin case x of 2: Inc(dwa); 3: Inc(tri); 4: Inc(shetire); 5: Inc(pati); end; end; begin case y of 2: Inc(dwa); 3: Inc(tri); 4: Inc(shetire); 5: Inc(pati); end; end; begin case z of 2: Inc(dwa); 3: Inc(tri); 4: Inc(shetire); 5: Inc(pati); end; end; WriteLn(#13#10'dwa: ', dwa, #13#10'tri: ', tri, #13#10'shetire: ', shetire, #13#10'pati: ', pati); ReadLn; { TODO -oUser -cConsole Main : Insert code here }end.
{$APPTYPE CONSOLE}
uses SysUtils;
var i,x,y,z, dwa,tri,shetire,pati:Integer;
begin
Writeln('student Fediya=');
Readln(i);
Writeln('student Sungat=');
readln(x);
Writeln('student Alex=');
readln(y);
Writeln('student Halif=');
Readln(z);
case i of
2: Inc(dwa);
3: Inc(tri);
4: Inc(shetire);
5: Inc(pati);
end;
begin
case x of
2: Inc(dwa);
3: Inc(tri);
4: Inc(shetire);
5: Inc(pati);
end;
end;
begin
case y of
2: Inc(dwa);
3: Inc(tri);
4: Inc(shetire);
5: Inc(pati);
end; end;
begin
case z of
2: Inc(dwa);
3: Inc(tri);
4: Inc(shetire);
5: Inc(pati);
end;
end;
WriteLn(#13#10'dwa: ', dwa, #13#10'tri: ', tri, #13#10'shetire: ', shetire, #13#10'pati: ', pati);
ReadLn;
{ TODO -oUser -cConsole Main : Insert code here }end.
Создаем в Excel VBA две пользовательские функции:
Function newstr(str As String, n As Integer) As String
Dim i As Integer
For i = 1 To n
str = Replace(str, "a", "ab")
str = Replace(str, "bb", "c")
Next
newstr = str
End Function
Function chrcount(str1 As String, str2 As String) As Integer
Dim str() As String
str = Split(str1, str2)
chrcount = UBound(str, 1)
End Function
В ячейку рабочего листа вставляем формулу:
= chrcount(newstr("abab"; 333); "a")&","&chrcount(newstr("abab"; 333); "b")&","&chrcount(newstr("abab"; 333); "c")
Получаем результат:
2,0,334