fork(31) download
  1. Program Totalogram;
  2. Var ch:string;
  3. (**************************************)
  4. Function lettre_maj_esp (ch:string):boolean;
  5. Var i:integer;
  6. test:boolean;
  7. Begin
  8. i:=1;
  9. test:=true;
  10. While (i<=length(ch)) and (test) do
  11. if ch[i] in ['A'..'Z',' '] Then i:=i+1
  12. Else test:=false;
  13. lettre_maj_esp:=test;
  14. End;
  15. (************************************)
  16. Function totalogramme (ch:string):boolean;
  17. Var p:integer;
  18. test:boolean;
  19. Begin
  20. ch:=ch+' ';
  21. Repeat
  22. p:=pos(' ',ch);
  23. test:=ch[1]=ch[p-1];
  24. delete(ch,1,p);
  25. Until (test=false) or (ch='');
  26. totalogramme:=test;
  27. End;
  28. (**************** P.P ******************)
  29. Begin
  30. Repeat
  31. Writeln('Saisir une chaƮne en majuscule :');
  32. Readln(ch);
  33. Until lettre_maj_esp(ch);
  34. If totalogramme(ch) Then writeln('totalogramme')
  35. Else writeln('non totalogramme');
  36. End.
Success #stdin #stdout 0s 232KB
stdin
BAC
stdout
Saisir une chaîne en majuscule :
non totalogramme