fuckingPascal

crypt aaaFyyssssssazz

Nov 21st, 2019
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.00 KB | None | 0 0
  1. //http://www.kiteb.net/education/informatique/bac/bacinfo2009/bac-pratique-20052009-sc-14h.pdf
  2.  
  3.  
  4. program Hello;
  5. uses crt;
  6. var ch:string;
  7.  
  8. procedure s(var ch:string);
  9. var i:integer; b:boolean;
  10. begin
  11. repeat
  12.     writeln('ch: '); read(ch);
  13.     i:= 1; b:=true;
  14.     repeat
  15.     if (upcase(ch[i]) in ['A'..'Z']) then
  16.         i:= i + 1
  17.     else
  18.         b:= false;
  19.     until (not(b)) or (i>length(ch));
  20. until (b) and (length(ch)<59) and (ch<>'');
  21. end;
  22.  
  23. function crypt(ch:string):string;
  24. var nb,i:integer;  c:char; ch2,s:string;
  25. begin
  26. ch2:=ch+' ';
  27. s:='';
  28. crypt:= '';
  29. nb:= 0;  
  30. c:= ch2[1];
  31.  
  32.     for i:= 1 to length(ch2) do
  33.         if (ch2[i]=c) then
  34.             begin
  35.             nb:= nb + 1;
  36.             //writeln(nb,ch2[i]);
  37.             end
  38.         else
  39.         begin
  40.             str(nb,s);
  41.             crypt:= crypt+s+ch2[i-1];
  42.             writeln(crypt);
  43.             c:= ch2[i];
  44.             nb:= 1;
  45.         end;
  46.         writeln(crypt)
  47. end;
  48.  
  49.  
  50. begin
  51.   s(ch);
  52.   crypt(ch);
  53. end.
Add Comment
Please, Sign In to add comment