import java.io.IOException; import java.io.InputStream; import java.io.PrintStream; import java.io.PrintWriter; import java.math.BigDecimal; import java.math.BigInteger; import java.text.Format; import java.util.*; import java.util.function.BinaryOperator; import java.util.function.Function; import java.util.function.IntPredicate; import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.stream.IntStream; @SuppressWarnings("unchecked") public class Main { public static void main(String[] args) { solve(System.in, System.out); } private void solve(PrintWriter pw, FastScanner fs) { var s = fs.n().toCharArray(); var list = new LinkedList(); for (int i = 0; i < s.length; i++) { if (list.size() == 0) { list.addLast(s[i]); } else { var size = list.size(); if (s[i] == '=' && (char) list.get(size - 1) == s[i]) { while (list.size() > 0 && list.get(list.size() - 1) == '=') { list.pollLast(); } list.addLast('='); continue; } if (s[i] == '>' && (char) list.get(size - 1) == '=' && (char) list.get(size - 2) == '<' ) { list.pollLast(); list.pollLast(); continue; } list.addLast(s[i]); } } pw.println(list.size()); } //-------------- record TPair(S a, T b) { } record TTri(S a, T b, U c) { } record Pair(long a, long b) { } record IntPair(int a, int b) { } record Triple(long a, long b, long c) { } public static int[] concat(int[] a, int[] b) { var ret = new int[a.length + b.length]; for (int i = 0; i < a.length; i++) { ret[i] = a[i]; } for (int i = 0; i < b.length; i++) { ret[i + a.length] = b[i]; } return ret; } public static long[] concat(long[] a, long[] b) { var ret = new long[a.length + b.length]; for (int i = 0; i < a.length; i++) { ret[i] = a[i]; } for (int i = 0; i < b.length; i++) { ret[i + a.length] = b[i]; } return ret; } public static void solve(InputStream in, PrintStream out) { PrintWriter pw = new PrintWriter(out); FastScanner fs = new FastScanner(in); try { new Main().solve(pw, fs); } finally { pw.flush(); } } //------------------------------------------------------------------- private static void debug(Object x) { System.err.println(x); } private static void debugArray(int[][] arr) { for (int i = 0; i < arr.length; i++) { debugArray(arr[i]); } } private static void debugArray(long[][] arr) { for (int i = 0; i < arr.length; i++) { debugArray(arr[i]); } } private static void debugArray(int[] arr) { debug(Arrays.toString(arr)); } private static void debugArray(long[] arr) { debug(Arrays.toString(arr)); } private static void debugArray(boolean[] arr) { debug(Arrays.toString(arr)); } private static void debugArray(boolean[][] arr) { for (int i = 0; i < arr.length; i++) { debugArray(arr[i]); } } /** * 各インデックスが配列の長さ以内に収まっているか境界チェックを行う *

* 多次元配列のチェックをいちいち書くのがしんどい時に。 * arrayBound(new int[]{1,2,3} , new int[]{3,4,3}) * * @param target 配列に設定したいインデックス * @param len  配列の長さ * @return 配列の長さ内に収まってる時 true */ private static boolean inarr(int[] target, int[] len) { var b = true; if (target.length != len.length) { throw new IllegalArgumentException(); } for (int i = 0; i < target.length; i++) { b &= (0 <= target[i] && target[i] < len[i]); } return b; } private static int[] arr(int... a) { return Arrays.copyOf(a, a.length); } private static long[] arr(long... a) { return Arrays.copyOf(a, a.length); } //半時計90度回転 private static int[][] rot(int[][] grid) { var h = grid.length; var w = grid[0].length; var result = new int[w][h]; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { result[w - 1 - j][i] = grid[i][j]; } } return result; } //http://fantom1x.blog130.fc2.com/blog-entry-194.html /** *

指定した値以上の先頭のインデクスを返す

*

配列要素が0のときは、0が返る。

* * @param arr : 探索対象配列(単調増加であること) * @param value : 探索する値 * @returnint : 探索した値以上で、先頭になるインデクス */ public static final int lowerBound(final long[] arr, final long value) { int low = 0; int high = arr.length; int mid; while (low < high) { mid = ((high - low) >>> 1) + low; //(low + high) / 2 (オーバーフロー対策) if (arr[mid] < value) { low = mid + 1; } else { high = mid; } } return low; } /** *

指定した値より大きい先頭のインデクスを返す

*

配列要素が0のときは、0が返る。

* * @param arr : 探索対象配列(単調増加であること) * @param value : 探索する値 * @returnint : 探索した値より上で、先頭になるインデクス */ public static final int upperBound(final long[] arr, final long value) { int low = 0; int high = arr.length; int mid; while (low < high) { mid = ((high - low) >>> 1) + low; //(low + high) / 2 (オーバーフロー対策) if (arr[mid] <= value) { low = mid + 1; } else { high = mid; } } return low; } //---------------- //------------------------------------------------------------------- } class FastScanner { InputStream in; byte[] buffer = new byte[1 << 10]; int length = 0; int ptr = 0; private final Predicate isPrintable; public FastScanner(InputStream in) { this.in = in; this.isPrintable = b -> (33 <= b && b <= 126); } public FastScanner(InputStream in, Predicate predicate) { this.in = in; this.isPrintable = predicate; } private boolean hasNextByte() { if (ptr < length) { return true; } try { length = in.read(buffer); } catch (IOException e) { e.printStackTrace(); } ptr = 0; return length != 0; } private byte read() { if (hasNextByte()) { return buffer[ptr++]; } return 0; } private void skip() { while (hasNextByte() && !isPrintable(buffer[ptr])) { ptr++; } } private boolean hasNext() { skip(); return hasNextByte(); } private boolean isPrintable(byte b) { return 33 <= b && b <= 126; } private String innerNext(Predicate isReadable) { if (!hasNext()) { throw new NoSuchElementException(); } StringBuilder sb = new StringBuilder(); byte b = read(); while (isReadable.test(b)) { sb.appendCodePoint(b); b = read(); } return sb.toString(); } public String n() { return innerNext(b -> (33 <= b && b <= 126)); } public int ni() { return (int) nl(); } public char[][] ncaa(int n, int m) { var grid = new char[n][m]; for (int i = 0; i < n; i++) { grid[i] = n().toCharArray(); } return grid; } public int[] nia(int n) { int[] result = new int[n]; for (int i = 0; i < n; i++) { result[i] = ni(); } return result; } public int[][] niaa(int h, int w) { int[][] result = new int[h][w]; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { result[i][j] = ni(); } } return result; } public long[][] nlaa(int h, int w) { long[][] result = new long[h][w]; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { result[i][j] = nl(); } } return result; } public String[] na(int n) { String[] result = new String[n]; for (int i = 0; i < n; i++) { result[i] = n(); } return result; } public long[] nla(int n) { long[] result = new long[n]; for (int i = 0; i < n; i++) { result[i] = nl(); } return result; } public long nl() { if (!hasNext()) { throw new NoSuchElementException(); } long result = 0; boolean minus = false; byte b; b = read(); if (b == '-') { minus = true; b = read(); } while (isPrintable(b)) { if (b < '0' || b > '9') { throw new NumberFormatException(); } result *= 10; result += (b - '0'); b = read(); } return minus ? -result : result; } }