Pagini recente » Cod sursa (job #871573) | Cod sursa (job #187140) | preONI 2005 runda #1 - solutii | Cod sursa (job #908908) | Cod sursa (job #645372)
Cod sursa(job #645372)
program include;
uses crt;
var fi,fo:text;
s1,s2,s:string;
i,j,k:integer;
c:char;
t:boolean;
begin
clrscr;
assign(fi,'strmatch.in');
reset(fi);
while not seekeoln(fi) do
begin
read(fi,c);
s1:=s1+c;
end;
readln(fi);
while not seekeoln(fi) do
begin
read(fi,c);
s2:=s2+c;
end;
for i:=1 to length(s2)-length(s1)+1 do
begin
if s2[i]=s1[1] then
begin
t:=true;
for j:=i to i+length(s1)-1 do
if s2[j]<>s1[j-i+1] then t:=false;
if t=true then inc(k);
end;
end;
assign(fo,'strmatch.out');
rewrite(fo);
writeln(fo,k);
close(fo);
end.