import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] counts = new int[26]; for (char c : sc.next().toCharArray()) { counts[c - 'a']++; } int ans = Math.min(Math.min(counts['t' - 'a'], counts['r' - 'a']), counts['e' - 'a'] / 2); System.out.println(ans); } }