Skip to content

Instantly share code, notes, and snippets.

@gurkanoluc
Created January 11, 2011 20:33
Show Gist options
  • Save gurkanoluc/775075 to your computer and use it in GitHub Desktop.
Save gurkanoluc/775075 to your computer and use it in GitHub Desktop.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Memo1: TMemo;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var kelime, temp : String;
var k, i, j, harfSayisi : Integer;
begin
kelime := Edit1.Text;
harfSayisi := Length(kelime);
temp := '';
for i := 1 to harfSayisi do
begin
k := 0;
if Pos(Copy(kelime, i, 1), temp) = 0 then
begin
for j := 1 to harfSayisi do
begin
if(Copy(kelime, i, 1) = Copy(kelime, j, 1)) then
k := k + 1;
end;
temp := temp + Copy(kelime, i, 1);
Memo1.Lines.Add(Copy(kelime, i, 1) + ' --- ' + IntToStr(k));
end
end
end;
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment