Skip to content

Instantly share code, notes, and snippets.

@m0hmad
Last active March 2, 2018 08:44
Show Gist options
  • Save m0hmad/497c416fcde3d9d2866345a861b734b4 to your computer and use it in GitHub Desktop.
Save m0hmad/497c416fcde3d9d2866345a861b734b4 to your computer and use it in GitHub Desktop.
{
getMsgPrice(a, b)
a - строка букв для пойска
b - общее сообщение
}
program chitcom;
function getMsgPrice( a, b: string ): integer;
var
count, i, j: integer;
begin
count := 0;
i := 1;
while i <= length( a ) do
begin
j := 1;
while j <= length( b ) do
begin
if ( a[i] = b[j] ) and
( a[i] <> chr(208) ) and ( a[i] <> chr(209) ) and
( b[j] <> chr(208) ) and ( b[j] <> chr(209) ) then
begin
count := count + 1
end;
j := j + 1
end;
i := i + 1
end;
getMsgPrice := count
end;
var
p: integer;
begin
if ParamCount() < 2 then
begin
writeln( 'Error Input: no arguments' );
halt( 1 )
end;
p := getMsgPrice( ParamStr(1), ParamStr(2) );
writeln( p )
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment