program WordInStringChecker;
function IsTwoWordsInString(str, w1, w2: string): Boolean;
begin
// Checks if both words are present in the string
IsTwoWordsInString := (Pos(w1, str) > 0) and (Pos(w2, str) > 0);
end;
var
str, w1, w2: string;
resultFlag: Boolean;
begin
str := 'Pascal is an imperative and procedural programming language, ' +
'encourage good programming practices';
w1 := 'Pascal';
w2 := 'good';
resultFlag := IsTwoWordsInString(str, w1, w2);
if resultFlag then
WriteLn('true')
else
WriteLn('false');
end.
(*
run:
true
*)