// stdin
macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

// input
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// Test
macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

#[allow(dead_code)]
fn gcd(x: i64, y: i64) -> i64 {
    if y == 0 {
        return x;
    }
    gcd(y, x % y)
}

#[test]
fn test_primes() {
    assert_eq!(primes(1), vec![1]);
    assert_eq!(primes(140), vec![1, 2, 2, 5, 7])
}

#[allow(dead_code)]
fn primes(num: i64) -> Vec<i64> {
    let mut ans = vec![1];
    let mut cur = num;
    for i in 2.. {
        if i * i > num { break; }
        if cur % i == 0 {
            while cur % i == 0 {
                ans.push(i);
                cur /= i;
            }
        }
    }
    if cur > 1 {
        ans.push(cur);
    }
    return ans;
}


test! {
r"<>>
" => r"3",

r"<>>><<><<<<<>>><
" => r"28"
}

fn calc(buf: &Vec<char>) -> i64 {
    let mut ans = 0;
    let mut l: i64 = 0;
    let mut r: i64 = 0;
    for buf_char in buf.clone() {
        match buf_char {
            '>' => l += 1,
            '<' => r += 1,
            _ => unreachable!(),
        }
    }
    if l > r {
        r -= 1;
    } else if r > l {
        l -= 1;
    } else {
        // 同数だったら片方を1減らすがとりあえずrにしとく
        r -= 1;
    }


    for l_tmp in 0..l + 1 {
        ans += l_tmp;
    }
    for r_tmp in 0..r + 1 {
        ans += r_tmp
    }
    return ans;
}

fn solve(src: &str) -> String {
    input! {
        source=src,
        s:chars
//        n:usize,
//        a:[i32;n],
    }
    let mut s: Vec<char> = s;

    let mut ans = 0;

    let mut prev = ' ';
    let mut buf = vec![];
    for (index, &chr) in s.iter().enumerate() {
        if index == 0 {
            prev = chr;
            buf.push(chr);
            continue;
        }
        if prev == '>' && chr == '<' {
            ans += calc(&buf);
            buf.clear();
        }

        prev = chr;
        buf.push(chr);
    }
    let b_len = buf.len() as i64;

    if b_len > 0 {
//        for buf_tmp in 0..b_len + 1 {
//            ans += buf_tmp;
//        }
        ans += calc(&buf);
    }


    format!("{}", ans)

    // 0<1<2>1>0
    // < x 2 ?
    // > x 2 - 1　同数だったら片方-1する


    // 0<3>2>1>0
    // < x 1 - 1
    // > x 3
    // 0<1<2>0
    // < x 2 ?
    // > x 1
    // 0<1<2<3<4<5>2>1>0
    // < x 5 => 15
    // > x 3 - 1 => 3 少ない方を -1カウントする
    // 0<1

    // 0+3+2+1+0+1+2+0+1+2+3+4+5+2+1+0+1
}


fn main() {
    println!("{}", solve(&stdin!()));
}



Measured memory_bytes: 12148