use std::io::{BufRead, Write}; struct Lines { b: B, buf: Vec } impl Lines { fn next(&mut self) -> &str { self.buf.clear(); self.b.read_until(b'\n', &mut self.buf).ok(); if self.buf.ends_with(&[b'\n']) { self.buf.pop(); if self.buf.ends_with(&[b'\r']) { self.buf.pop(); } } std::str::from_utf8(&self.buf).unwrap() } } macro_rules! parse { ($s:expr, Usize1) => (parse!($s, usize) - 1); ($s:expr, Bytes) => ($s.as_bytes().to_vec()); ($s:expr, Chars) => ($s.chars().collect::>()); ($s:expr, $t:ty) => ($s.parse::<$t>().unwrap()); } macro_rules! scan { ($iter:expr, ($($t:ident),*)) => ( ($(scan!($iter, $t)),*) ); ($iter:expr, [$t:ident]) => ( $iter.map(|s| parse!(s, $t)).collect::>() ); ($iter:expr, $t:ident) => ( parse!($iter.next().unwrap(), $t) ); } macro_rules! read { ($lines:expr, [$t:tt; $n:expr]) => ( (0..$n).map(|_| read!($lines, $t)).collect::>() ); ($lines:expr, $t:tt) => ({ let iter = &mut $lines.next().split(' '); scan!(iter, $t) }); } fn run(mut lines: Lines, mut writer: W) { let s = read!(lines, Bytes); let b0 = s.first().unwrap(); let mut b1 = b0; let mut cnt = [0, 0]; let mut pos = [0, 0]; for (i, b) in s.iter().enumerate() { if b == b0 { cnt[0] += 1; pos[0] = i + 1; } else { b1 = b; cnt[1] += 1; pos[1] = i + 1; } } if cnt[0] == 1 { writeln!(writer, "{} {}", pos[0], *b0 as char).ok(); } else { writeln!(writer, "{} {}", pos[1], *b1 as char).ok(); } } fn main() { let (stdin, stdout) = (std::io::stdin(), std::io::stdout()); let lines = Lines { b: stdin.lock(), buf: Vec::new() }; run(lines, std::io::BufWriter::new(stdout.lock())); }