Problem:
Score : 100 points

Problem Statement

You are given a string S of length 3 consisting of a, b and c. Determine if S can be obtained by permuting abc.

Constraints

|S|=3

S consists of a, b and c.

Input

Input is given from Standard Input in the following format:

S

Output

If S can be obtained by permuting abc, print Yes; otherwise, print No.

Sample Input 1

bac

Sample Output 1

Yes

Swapping the first and second characters in bac results in abc.

Sample Input 2

bab

Sample Output 2

No

Sample Input 3

abc

Sample Output 3

Yes

Sample Input 4

aaa

Sample Output 4

No

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

use std::io::*;
use std::str::FromStr;
use std::cmp::{min, max};
use std::rc::Rc;
use std::mem::swap;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin_lock = stdin.lock();
    let s = stdin_lock
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok().unwrap()
}

static DX: &'static [i32] = &[0, 0, 1, -1];
static DY: &'static [i32] = &[1, -1, 0, 0];

fn dfs(x: usize, y: usize, a: i32, b: i32, dir: usize, map: &Vec<Vec<char>>, gx: usize, gy: usize) -> bool {
    if a < 0 || b < 0 {
        return false;
    }

    if map[y][x] == '#' {
        return false;
    }

    if x == gx && y == gy && a == 0 && b == 0{
        return true;
    }

    let mut ans = false;

    if dir == 0 {
        ans |= dfs(x + 1, y, a, b, 0, &map, gx, gy);
        ans |= dfs(x, y + 1, a, b - 1, 1, &map, gx, gy);
        ans |= dfs(x, y - 1, a - 1, b, 3, &map, gx, gy);
    } else if dir == 1 {
        ans |= dfs(x, y + 1, a, b, 1, &map, gx, gy);
        ans |= dfs(x + 1, y, a - 1, b, 0, &map, gx, gy);
        ans |= dfs(x - 1, y, a, b - 1, 2, &map, gx, gy);
    } else if dir == 2 {
        ans |= dfs(x - 1, y, a, b, 2, &map, gx, gy);
        ans |= dfs(x, y + 1, a - 1, b, 1, &map, gx, gy);
        ans |= dfs(x, y - 1, a, b - 1, 3, &map, gx, gy);
    } else {
        ans |= dfs(x, y - 1, a, b, 3, &map, gx, gy);
        ans |= dfs(x + 1, y, a, b - 1, 0, &map, gx, gy);
        ans |= dfs(x - 1, y, a - 1, b, 2, &map, gx, gy);
    }

    return ans;
}

fn main() {
    let s = read::<String>();

    let mut abc = s.chars().collect::<Vec<char>>();

    abc.sort();

    if abc.into_iter().collect::<String>() == "abc" {
        println!("Yes");
    } else {
        println!("No");
    }
}