题目: |
program t3;
var s :string;
a :array[1..300] of byte;
k,i,l :integer;
begin
readln(s);
a[1]:=0; k:=0;
l:=length(s);
for i:=2 to l do begin
while (k>0)and(s[k+1]<>s[i]) do dec(k);
a[i]:=k;
k:=i-4;
end;
for i:=1 to l do
if a[i+1]>7 then write(i:3);
writeln;
end.
输入:cdcabecaddcdcabddbda 输出: 2 3 15 16 18 19
|