#![allow(non_snake_case, unused_must_use, unused_imports)] use std::io::{self, prelude::*}; fn main() { let (stdin, stdout) = (io::read_to_string(io::stdin()).unwrap(), io::stdout()); let (mut stdin, mut buffer) = (stdin.split_whitespace(), io::BufWriter::new(stdout.lock())); macro_rules! input { ($t: ty, $n: expr) => { (0..$n).map(|_| input!($t)).collect::>() }; ($t: ty) => { stdin.next().unwrap().parse::<$t>().unwrap() }; } let S = input!(String).chars().collect::>(); let mut stack = vec![]; for s in S { match s { '<' => { stack.push(('<', 1)); } '>' => { let l = stack.len(); if l >= 2 && stack[l - 1].0 == '=' && stack[l - 2].0 == '<' { stack.pop(); stack.pop(); } else { stack.push(('>', 1)); } } '=' => { if let Some((c, a)) = stack.pop() { if c == '=' { stack.push(('=', a + 1)); } else { stack.push((c, a)); stack.push(('=', 1)); } } else { stack.push(('=', 1)); } } _ => unreachable!(), } } let ans = stack.into_iter().map(|(_, c)| c).sum::(); writeln!(buffer, "{}", ans); }