import java.util.Scanner; class Tree{ private int t ; private int r ; private int e ; private int treeCount; public Tree(int a,int b,int c){ this.t = a; this.r = b; this.e = c; } public void makeTree(){ while(true){ this.t -= 1; this.r -= 1; this.e -= 2; if(this.t >= 0 && this.r >= 0 && this.e >= 0){ treeCount++; } else{ break; } } } public void showTreeCount(){ System.out.println(this.treeCount); } } public class No_279 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String sample = sc.next(); char[] pieceOfSample = sample.toCharArray(); int tCount = 0; int rCount = 0; int eCount = 0; for(char c:pieceOfSample){ switch(c){ case 't':tCount++;break; case 'r':rCount++;break; case 'e':eCount++;break; } } Tree tree = new Tree(tCount,rCount,eCount); tree.makeTree(); tree.showTreeCount(); } }