#![allow(non_snake_case, unused_imports)] use itertools::Itertools; use proconio::{input, marker::Chars, marker::Usize1}; use std::cmp::{Reverse, max, min}; use std::collections::{BinaryHeap, HashMap, HashSet, VecDeque}; #[allow(unused_macros)] macro_rules! d { ( $( $x:expr ),* $(,)? ) => { eprintln!( concat!( $( stringify!($x), "={:?} " ),* ), $( $x ),* ); }; } #[allow(dead_code)] fn yn(b: bool) -> &'static str { if b { "Yes" } else { "No" } } fn main() { input! { X: Chars, Y: Chars, Z: Chars, } let mut st = HashSet::new(); for i in 0..X.len() { for j in 0..Y.len() { for k in 0..Z.len() { let a = X[..=i].iter().collect::(); let b = Y[..=j].iter().collect::(); let c = Z[..=k].iter().collect::(); for s in [a, b, c].iter().permutations(3) { let t = s.iter().join(""); st.insert(t); } } } } println!("{}", st.len()); }