Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program TrentTroisDix;
- uses WinCrt;
- Type
- mat = Array [1..10,1..10] of char ;
- var
- msg : string ;
- Function verif(ch : string ):boolean;
- var
- vf : Boolean; //7777133166130661881313317777
- a,c: integer;
- h : char ;
- begin
- vf:= true;
- if ch[1] = '1' then
- vf := False
- Else
- begin
- h:= ch[1];
- c:=0;
- a:=1;
- while (vf= true) and (a<=Length(ch)) do
- begin
- if ch[a] = h then
- begin
- c:=c+1;
- if (not(h in ['9','7']) and (c>=4) ) or (c>=5) then
- vf := false
- end
- else
- if (ch[a] <> h) and not (ch[a]in ['1','0']) then
- vf := false
- else if not(ch[a] in ['0'..'9']) then
- vf:= false
- Else
- begin
- h:=ch[a+1];
- c:=0;
- end;
- a:=a+1;
- end;
- end;
- verif := vf;
- end;
- procedure saisi(var msg : string );
- Begin
- repeat
- write('Msg= ');
- readln(msg);
- writeln(verif(msg))
- until verif(msg);
- end;
- procedure rempM(var m : mat );
- var
- x,l,c,lim : integer;
- Begin
- x:=97;
- for l:=2 to 9 do
- begin
- if l in [7,9] then
- lim :=4
- Else
- lim:=3;
- for c:=1 to lim do
- begin
- m[l,c]:=chr(x);
- x:=x+1;
- end;
- end;
- End;
- function aff(ch: string):string;
- var
- c : String;
- a,x,b: integer;
- h: char;
- m : mat;
- begin
- rempm(m);
- While ch[Length(ch)] in ['1','0'] do
- delete(ch,Length(ch),1);
- ch:='1'+ch;
- c:='';
- repeat
- h:=ch[Length(ch)];
- x:=0;
- b:= Length(ch);
- while not(ch[b] in ['1','0'])do
- Begin
- b:=b-1;
- x:=x+1;
- end;
- if ch[b]='0' then
- c := ' '+m[ord(ch[b+1])-48,x]+c
- Else
- c := m[ord(ch[b+1])-48,x]+c ;
- delete(ch,Length(ch)-x,x+1);
- until Length(ch) = 0 ;
- aff:=c;
- end;
- Begin
- saisi(msg);
- writeln(aff(msg));
- End.
Advertisement
Add Comment
Please, Sign In to add comment