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 1786. Sandro's Biography

WA 7
Posted by Tsukanov 21 Apr 2012 03:50
Can somebody help me? What's the problem?


program BgrSandro;
type t = 'A'..'Z';
const andro = 'andro';
      lowcs=['a'..'z'];
var
  i,j,c,min: integer;
  s: string;
  set1: set of t;
Begin
  set1:=['A'..'Z'] - ['A','N','D','R','O'];
  readln(s);
  min:=20;
  for i:=1 to (Length(s)-5) do begin
      c:=0;
      if (s[i]<>'S') then begin
        inc(c);
        if (s[i]<>'s') and (s[i] in lowcs) then inc(c)
      end;
      for j:=1 to 5 do begin
        if (s[i+j]<>andro[j]) then begin
          inc(c);
          if (s[i+j] in set1) then inc(c)
        end
      end;
      if (c<min) then min:=c;
  end;
  writeln(min*5);
end.

Edited by author 21.04.2012 03:52