Created
March 30, 2013 00:28
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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