function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim();}
function myout(t){console.log(t);}//standard output
//[no]param
//0:何もしない  1:数値へ変換  2:半角SPで分割  3:改行で分割  4:半角SPで分割し、数値配列へ
//5:改行で分割し、数値配列へ  6:1文字に分割  7:1文字に分割し、数値配列へ
function myconv(i,no){switch(no){case 0:return i;case 1:return parseInt(i);case 2:return i.split(" ");case 3:return i.split("\n");case 4:return i.split(" ").map((a)=>Number(a));case 5:return i.split("\n").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));}}

function Main(input) {
  var counter = new Array(input.length+1);
  input = myconv(input,6);
  var indexX = [];
  var indexZero = [];
  if(input[0] == "<"){
     counter[0] = 0;
    indexZero.push(0);
  }else{
     counter[0] = "x";
    indexX.push(0);
  }
  
  for(var i = 1; i < input.length; i++){
    var mae = input[i-1];
    var ato = input[i];
    if(mae == ">" && ato == "<"){
       counter[i] = 0;
      indexZero.push(i);
    }else if(mae == "<" && ato == ">"){
       counter[i] = "x";      
      indexX.push(i);
	}
  }
  
  if(input[input.length-1] == ">"){
     counter[input.length] = 0;
    indexZero.push(input.length);
  }else{
    counter[input.length] = "x";
    indexX.push(input.length);
  }
  /*myout("x:" + indexX);
  myout("0:" + indexZero);
  myout(counter);*/
  var sum = 0;
  if(indexX.length > indexZero.length){
       var tmp = indexX;
       indexX = indexZero;
    indexZero = tmp;
	}else if(indexX.length == indexZero.length){
        if(indexX[0] == 0){
           indexZero.unshift(-1);
           }else{
           indexZero.push(indexX[indexX.length-1]+1);
           }
    }
  
  //myout("x:" + indexX);
  //myout("0:" + indexZero);
  for(var i = 0; i < indexX.length; i++){
    var index = indexX[i];
    var mae = index - indexZero[i];
    var ato = indexZero[i+1] - index;
    if(mae > ato){
       counter[index] = mae;
      sum += (mae*(mae+1)/2) + ((ato-1)*(ato)/2);
    }else if(mae < ato){
         counter[index] = ato;
      sum += (ato*(ato+1)/2) + ((mae-1)*(mae)/2);
    }else{
      counter[index] = ato;
      sum += (ato*(ato+1)/2) + ((mae-1)*(mae)/2);
    }
  }
  //myout(counter);
  myout(sum);
}

Main(myin());
