use std::cmp::*; use std::collections::*; use std::io::*; use std::str::FromStr; fn read() -> T { let stdin = stdin(); let stdin = stdin.lock(); let token: String = stdin .bytes() .map(|c| c.expect("failed to read char") as char) .skip_while(|c| c.is_whitespace()) .take_while(|c| !c.is_whitespace()) .collect(); token.parse().ok().expect("failed to parse token") } fn main(){ let s:String = read(); if(s == "1" || s == "2"){ println!("-1"); }else{ let mut n:Vec = s.chars().collect(); let mut dig = vec![0;10]; for i in n{ dig[(i as i32 - 48) as usize] += 1; } let mut k = 0; for i in dig{ k = max(k,i); } match k{ 1 => println!("1"), _ => println!("-1"), } } }