Problem:
Score : 100 points

Problem Statement

Joisino wants to evaluate the formula "A op B".
Here, A and B are integers, and the binary operator op is either + or -.
Your task is to evaluate the formula instead of her.

Constraints

1≦A,B≦10^9

op is either + or -.

Input

The input is given from Standard Input in the following format:

A op B

Output

Evaluate the formula and print the result.

Sample Input 1

1 + 2

Sample Output 1

3

Since 1 + 2 = 3, the output should be 3.

Sample Input 2

5 - 7

Sample Output 2

-2

Solution in Rust (1.15.1) (judge verdict: Accepted)

use std::io;

enum Op {
    Plus,
    Minus
}

fn parse(input: &String) -> Option<(i32, Op, i32)> {
    let splitted = input.split_whitespace().collect::<Vec<&str>>();

    if splitted.len() != 3 {
        return None;
    }

    let a = match splitted[0].parse::<i32>() {
        Ok(x) => x,
        Err(_) => return None,
    };

    let op = match splitted[1] {
        "+" => Op::Plus,
        "-" => Op::Minus,
        _ => return None
    };

    let b = match splitted[2].parse::<i32>() {
        Ok(x) => x,
        Err(_) => return None
    };

    Some((a, op, b))
}

fn calc(a: i32, op: Op, b: i32) -> i32 {
    match op {
        Op::Plus => a + b,
        Op::Minus => a - b
    }
}

fn main() {
    let mut buffer = String::new();
    match io::stdin().read_line(&mut buffer) {
        Ok(_) => {
            let (a, op, b) = parse(&buffer).unwrap();
            println!("{}", calc(a, op, b));
        },
        Err(_) => println!("Err"),
    };
}