%begin;  !Generate Certificate
%constinteger initlines=6, nameline=12, restlines=17

%conststring(31)%array INIT(1:initlines) =
  "$f52=52 s=2.5",
  "$f32=33 s=2.0",
  "$f61=61 s=1.6",
  "$f14=14 s=1.5",
  "$f4=16 s=1.3",
  "$f3=16 s=1.6"
  
%conststring(63)%array REST(1:restlines) =
  "$b6 $14 $l1mh",
  "SCOTTISH MATHEMATICAL COUNCIL",
  "$b8 $52 $l1mh",
  "Mathematical Challenge 1983/84",
  "$b7 $4 $l1m",
  "Section III",
  "$b3 $4 $l1mh",
  "Borders, Dumfries and Galloway, and Lothian Regions",
  "$b6 $3 $l0m",
  "This is to certify that",
  "$b4 $32$l1m",
  "",
  "$b4 $3 $l0m",
  "received honourable mention in the above competition",
  "$b17 $4 $l1m",
  "Chairman of Section",
  "$n"

%integer i,k,l,first,last
%string(255) name,fname
  prompt("Name(s):")
  first = 1
  %cycle
    fname = "";  name = ""
    read symbol(k) %until k > ' '
    last = ' '
    %cycle
      k = k&95 %if last = ' ' %and 'a' <= k <= 'z'
      name = name.tostring(k)
      fname = fname.tostring(k&95) %if 'A' <= k&95 <= 'Z' %and length(fname)<8
      last = k
      read symbol(k)
    %repeat %until k = ',' %or k = nl
    %if first # 0 %start
      fname = fname.".LAY"
      open output(1,"LP1:".fname)
      first = 0
      %for i = 1,1,initlines %cycle
        printstring(init(i));  newline
      %repeat
    %finish
    select output(1)
    %for i = 1,1,restlines %cycle
      printstring(rest(i))
      printstring(name) %if i = nameline
      newline
    %repeat
  %repeat %until k # ','
%endofprogram
