Write a program to determine if a line contains at least one word beginning with “z”. Words are separated by spaces.

The program detects the presence of words in the string that begin with “z” and “Z”.

program letter_z;
var s: string;
k: integer;
begin
writeln (‘Enter a few words separated by a space:’);
readln (s);
k: = 0;
for i: integer: = 1 to length (s) do
begin
// If z is at the beginning of the line
if (i = 1) and ((s [1] = ‘z’) or (s [1] = ‘Z’)) then k: = k + 1;
// If a word begins with z and this word is not the first in the line
if (i> 1) and ((s [i – 1] + s [i] = ‘z’) or (s [i – 1] + s [i] = ‘Z’)) then k: = k + one;
end;
writeln ();
if k> 0 then writeln (‘The line contains words starting with the letters “z” (‘, k, ‘).’)
else
writeln (‘The line contains no words starting with the letter “z”.’)
end.



One of the components of a person's success in our time is receiving modern high-quality education, mastering the knowledge, skills and abilities necessary for life in society. A person today needs to study almost all his life, mastering everything new and new, acquiring the necessary professional qualities.