Skip to content

Instantly share code, notes, and snippets.

@tuankiet65
Created March 30, 2013 00:28
Show Gist options
  • Save tuankiet65/5274657 to your computer and use it in GitHub Desktop.
Save tuankiet65/5274657 to your computer and use it in GitHub Desktop.
Nhập một xâu , xác định xâu được lặp lại và được lập lại bao nhiêu lần
program bt1;
uses crt;
var s, s2, s3: string;
i, i2: longint;
begin
clrscr;
write('Nhap s: ' );
readln(s);
for i:=1 to length(s) do begin
if length(s) mod i=0 then begin
s2:=copy(s, 1, i);
for i2:=1 to length(s) div i do s3:=s3+s2;
if s3=s then break;
s3:='';
s2:=''
end;
end;
write('Xau lap lai: ', s2, ' voi so lan lap la ', length(s) div length(s2));
readkey;
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment