Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (*koliko se puta string a nalazi u stringu b*)
- MODULE zadatak;
- FROM InOut IMPORT WriteString,WriteLn,ReadString,WriteCard;
- FROM Strings IMPORT Length;
- TYPE
- String = ARRAY [1..100] OF CHAR;
- PROCEDURE Ucitaj(VAR str1,str2 : String) : CARDINAL;
- VAR
- br,i,j : CARDINAL;
- ok : BOOLEAN;
- BEGIN
- WriteString("Unesite prvi string: ");
- ReadString(str1);
- WriteString("Unesite drugi string: ");
- ReadString(str2);
- j:=1;
- br := 0;
- FOR i:=1 TO Length(str2) DO
- IF ORD(str1[j]) = ORD(str2[i]) THEN
- INC(j);
- IF (j > Length(str1)) THEN
- j:=1;
- INC(br);
- END;
- ELSE
- j := 1;
- END;
- END;
- RETURN br;
- END Ucitaj;
- VAR
- a,b : String;
- brPuta : CARDINAL;
- BEGIN
- brPuta := Ucitaj(a,b);
- WriteCard(brPuta,0);
- END zadatak.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement