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 Rust (1.15.1) (judge verdict: Runtime Error)

use std::io::prelude::*;
use std::io;
use std::cmp::*;

#[derive(PartialEq, Eq, Debug)]
enum Road {
    P(u64),
    Q(u64),
}

impl PartialOrd for Road {
    fn partial_cmp(&self, other: &Road) -> Option<Ordering> {
        let cs = match *self {
            P(c) | Q(c) => c,
        };
        let co = match *other {
            P(c) | Q(c) => c,
        };
        cs.partial_cmp(&co)
    }
}

impl Ord for Road {
    fn cmp(&self, other: &Road) -> Ordering {
        self.partial_cmp(other).unwrap()
    }
}

use Road::*;

fn read_to_string() -> String {
    let mut buf = String::new();
    let mut stdin = io::stdin();
    stdin.read_to_string(&mut buf);
    buf
}

fn solve(p: &[u64], q: &[u64]) -> u64 {
    let w = p.len();
    let h = q.len();
    let mut pq: Vec<_> = p.iter()
        .map(|c| P(*c))
        .chain(q.iter()
            .map(|c| Q(*c)))
        .collect();
    pq.sort();
    let mut a = w as u64 + 1;
    let mut b = h as u64 + 1;
    pq.iter()
        .map({
            |e| match *e {
                P(c) => {
                    a -= 1;
                    b * c
                }
                Q(c) => {
                    b -= 1;
                    a * c
                }
            }
        })
        .fold(0, std::ops::Add::add)
}

fn main() {
    let input = read_to_string();
    let mut words = input.split_whitespace();
    let w: usize = words.next().unwrap().parse().unwrap();
    let h: usize = words.next().unwrap().parse().unwrap();
    let p: Vec<u64> = words.by_ref().take(w).map(|i| i.parse().unwrap()).collect();
    let q: Vec<u64> = words.by_ref().take(h).map(|i| i.parse().unwrap()).collect();
    println!("{}", solve(&p, &q));
}