Problem:
Score : 100 points

Problem Statement

CODE FESTIVAL 2016 is going to be held. For the occasion, Mr. Takahashi decided to make a signboard.

He intended to write CODEFESTIVAL2016 on it, but he mistakenly wrote a different string S. Fortunately, the string he wrote was the correct length.

So Mr. Takahashi decided to perform an operation that replaces a certain character with another in the minimum number of iterations, changing the string to CODEFESTIVAL2016.

Find the minimum number of iterations for the rewrite operation.

Constraints

S is 16 characters long.

S consists of uppercase and lowercase alphabet letters and numerals.

Input

Inputs are provided from Standard Input in the following form.

S

Output

Output an integer representing the minimum number of iterations needed for the rewrite operation.

Sample Input 1

C0DEFESTIVAL2O16

Sample Output 1

2

The second character 0 must be changed to O and the 14th character O changed to 0.

Sample Input 2

FESTIVAL2016CODE

Sample Output 2

16

Solution in Pascal (FPC 2.6.2) (judge verdict: Runtime Error)

        {$mode objfpc}
        {$coperators on}
const
        sz=round(1e5)+100;
type
    Tnode = ^node;
    node  =
        record
            c:array['_'..'z'] of Tnode;
            cnt:longint;
        end;
var
    s:array[1..sz]of string;
    n,q,cur:longint;
    kth,ans:array[1..sz]of longint;
    a:array[1..sz]of ansistring;
    nod,root:Tnode;
    count:array[0..sz,'_'..'z','_'..'z']of longint;


function min(const x,y:longint):longint; begin if x<=y then exit(x) else exit(y); end;
function max(const x,y:longint):longint; begin if x>=y then exit(x) else exit(y); end;
procedure spaw(var nod:Tnode);
var i:char;
    begin
        new(nod);
        nod^.cnt:=0;
        for i:='_' to 'z' do nod^.c[i]:=nil;
    end;

procedure enter;
var i : integer;
    begin
        readln(n);
        for i:=1 to n do
            begin
                readln(a[i]);
                a[i]:=a[i]+'_';
            end;
        readln(q);
        for i:=1 to q do
            begin
                read(kth[i]);
                readln(s[i]);
                delete(s[i],1,1);
            end;
    end;
procedure update(const a:ansistring);
var ch,rr:char;
    i:longint;
    begin
        nod:=root;
        for i:=1 to length(a) do
            begin
                ch:=a[i];
                if nod^.c[ch]=nil then spaw(nod^.c[ch]);
                nod := nod^.c[ch];
                inc(nod^.cnt);
            end;
    end;
procedure updateElement(p:longint);
var i:longint;
    ch,rr:char;
    begin
        nod:=root;
        for i:=1 to length(a[p]) do
            begin
                ch:=a[p][i];
                for rr:='_' to 'z' do if (rr<>ch)and(nod^.c[rr]<>nil) then
                    count[p][ch][rr] += nod^.c[rr]^.cnt;
                nod:=nod^.c[ch];
            end;
    end;
procedure Build();
var i:longint;
    begin
        spaw(root);
        for i:=1 to n do
            begin
                update(a[i]);
            end;
        for i:=1 to n do
            begin
                updateElement(i);
            end;
    end;
procedure doQuerry(const s:string; kth:longint);
var i,j:longint;
    begin
        for i:=1 to 26 do
            for j:=1 to i-1 do ans[cur] += count[kth,s[i],s[j]];
        for i:=1 to 26 do ans[cur] += count[kth,s[i],'_'];
        ans[cur]+=1;
    end;
procedure solve;
var i: integer;
    begin
        Build();
        for i:=1 to q do
            begin
                cur:=i;
                doQuerry(s[i], kth[i]);
            end;
    end;
procedure print();
var i:longint;
    begin
        for i:=1 to q do
            writeln(ans[i]);
    end;
begin
        enter(); solve(); print();
end.