--写了一个楼主看看满意不var FDest: char; function Found(source: string; var dest: char): Integer; var I,J: Integer; count,tempCount: Integer; begin count := 0; tempCount:= 0; for I:=1 to length( source ) do begin for J := 1 to length(source) do if ( source[ I ] = source[ J ] ) then Inc( count, 1 ); if count > tempCount then begin tempCount:=Count; dest:=source[I]; end; Count:=0; end; Result:=tempCount; end; begin showmessage( IntToStr( Found( 'aaabbbccccccc',FDest ) ) ); showmessage( String( FDest ) ); end;
FDest: char;
function Found(source: string; var dest: char): Integer;
var
I,J: Integer;
count,tempCount: Integer;
begin
count := 0;
tempCount:= 0;
for I:=1 to length( source ) do
begin
for J := 1 to length(source) do
if ( source[ I ] = source[ J ] ) then
Inc( count, 1 );
if count > tempCount then
begin
tempCount:=Count;
dest:=source[I];
end;
Count:=0;
end;
Result:=tempCount;
end;
begin
showmessage( IntToStr( Found( 'aaabbbccccccc',FDest ) ) );
showmessage( String( FDest ) );
end;