SHARE
TWEET

Untitled

a guest Feb 18th, 2020 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var a,st,ansst : string;
  2. ans,i:integer;
  3. first:char;
  4. flag : boolean;
  5. begin
  6. readln(a);
  7. a := a.Trim();
  8. while(a.Contains('  ')) do a:=a.Replace('  ',' ');
  9. ans:=0;
  10. for i:=1 to a.Length do
  11. if(a[i] = ' ') then ans+=1;
  12. writeln('Количество слов: ',ans+1);
  13. i:=a.Length;
  14. ans:=0;
  15. while(i > 0) and (a[i] <> ' ') do begin
  16. if ((ord(a[i]) >= ord('a')) and (ord(a[i]) <= ord('z'))) or (((ord(a[i]) >= ord('A')) and (ord(a[i]) <= ord('Z'))) ) then ans+=1; i-=1; end;
  17. writeln('Букв в последнем слове: ', ans);
  18. ans:=0;
  19. flag:=true;
  20. for i:=1 to a.Length do begin
  21. if(flag) and ((a[i] = 'я') or (a[i] = 'Я')) then begin ans+=1; flag:=false; end;
  22. if(a[i] = ' ') then flag:=true;
  23. end;
  24. writeln('Встречается буква я: ', ans);
  25. writeln('Слова в обратном порядке: ');
  26. st:='';
  27. ansst:='';
  28. for i:=a.Length downto 1 do begin
  29. if(a[i] = ' ') then begin st:=string.Join('',st.Reverse().ToArray()); ansst+= st + ' '; st:='' end;
  30. st+=a[i];
  31. end;
  32. st:=string.Join('',st.Reverse().ToArray());
  33. ansst+= st + ' ';
  34. writeln(ansst);
  35.  
  36. ans:=0;
  37. flag:=true;
  38. i:=1;
  39. while(i<= a.Length) do begin
  40. if(a[i] = 'A') and  (a.IndexOf('$$',i) > 0) and ((a.IndexOf('$$',i)=a.Length-2)or (a[a.IndexOf('$$',i)+3] = ' ') or (a[a.IndexOf('$$',i)+3] = ',') or (a[a.IndexOf('$$',i)+3] = '.')) then begin ans+=1; i:=a.IndexOf('$$',i)+2; end;
  41. if(a[i] <> 'A') then begin i:=a.IndexOf(' ',i)+1; if(i=0) then break; end;
  42. i+=1;
  43. end;
  44. writeln('Начинаются на А, а заканчиваются на $$: ', ans);
  45. end.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top