summaryrefslogtreecommitdiff
path: root/kattis-open/sperhling/src/main.rs
blob: 93b1ed1a19dd8225092b92c07a5c3c69e21cb584 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::io::{stdin, BufRead};

fn main() {
    let stdin = stdin();
    let mut lines = stdin.lock().lines();
    let s1 = lines.next().unwrap().unwrap();
    let s2 = lines.next().unwrap().unwrap();

    let lcp = s1
        .bytes()
        .zip(s2.bytes())
        .take_while(|&(a, b)| a == b)
        .count();

    println!("{}", s1.len() + s2.len() - 2 * lcp);
}