Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //http://www.kiteb.net/education/informatique/bac/bacinfo2009/bac-pratique-20052009-sc-14h.pdf
- program Hello;
- uses crt;
- var ch:string;
- procedure s(var ch:string);
- var i:integer; b:boolean;
- begin
- repeat
- writeln('ch: '); read(ch);
- i:= 1; b:=true;
- repeat
- if (upcase(ch[i]) in ['A'..'Z']) then
- i:= i + 1
- else
- b:= false;
- until (not(b)) or (i>length(ch));
- until (b) and (length(ch)<59) and (ch<>'');
- end;
- function crypt(ch:string):string;
- var nb,i:integer; c:char; ch2,s:string;
- begin
- ch2:=ch+' ';
- s:='';
- crypt:= '';
- nb:= 0;
- c:= ch2[1];
- for i:= 1 to length(ch2) do
- if (ch2[i]=c) then
- begin
- nb:= nb + 1;
- //writeln(nb,ch2[i]);
- end
- else
- begin
- str(nb,s);
- crypt:= crypt+s+ch2[i-1];
- writeln(crypt);
- c:= ch2[i];
- nb:= 1;
- end;
- writeln(crypt)
- end;
- begin
- s(ch);
- crypt(ch);
- end.
Add Comment
Please, Sign In to add comment