ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1179. Numbers in Text

Help me please. TL_ing.
Posted by I am david. Tabo. 27 Dec 2002 18:39
program nn;
const hs='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';

var a:array[0..37]of longint;
    b:array[0..37]of boolean;
    K,J,KK,MAX:LONGINT;
    C:CHAR;


PROCEDURE SOLVE;
begin
 J:=POS(C,HS);
 IF J=0 THEN
  BEGIN
   FOR K:=2 TO 36 DO
    B[K]:=TRUE;
   EXIT;
  END;
 for k:=2 TO 36 DO
  BEGIN
   IF J>K THEN B[K]:=TRUE ELSE
    BEGIN
     IF B[K] THEN BEGIN INC(A[K]); B[K]:=FALSE; END ELSE B[K]:=FALSE;
    END;
  END;
end;

begin
 fillchar(a,sizeof(a),0);
 fillchar(B,SIZEOF(b),TRUE);
 while not eof do
  begin
    read(c);
    solve;
  end;
MAX:=-1;
FOR K:=2 TO 36 DO
 IF A[K]>MAX THEN
  BEGIN
   MAX:=A[K];
   KK:=K;
  END;
WRITELN(KK,' ',MAX);
end.