Advertisement
Guest User

Untitled

a guest
Dec 20th, 2012
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.64 KB | None | 0 0
  1. Program zadacha2;
  2. Var s,s1:string;
  3.     i,z,r,z1,r1:integer;
  4. Begin
  5. z1:=0;
  6. r1:=0;
  7. z:=0;
  8. r:=0;
  9.     write('Введите строку: ');
  10.     readln(s);
  11.     i:=0;
  12.     While i<Length(s) do
  13.      Begin
  14.       inc(i);
  15.       if not(s[i] in [' ',',']) then
  16.         Begin
  17.          if s[i]='*' then
  18.          z:=z+1;
  19.          if s[i]='#' then
  20.          r:=r+1;
  21.         End;
  22.         if (s[i] in [' ',',']) then begin
  23.         if z>0 then
  24.         z1:=z1+1;
  25.         if r>0 then
  26.         r1:=r1+1;
  27.         end;
  28.        
  29.       End;
  30. Write('Количество слов с * :',z1);
  31. Writeln;
  32. Write('Количество слов с # :',r1);
  33. End.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement