import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int q = in.nextInt(); for(int a0 = 0; a0 < q; a0++){ String s = in.next(); char ch []= new char[10]; ch[0]='h'; ch[1]='a'; ch[2]='c'; ch[3]='k'; ch[4]='e'; ch[5]='r'; ch[6]='r'; ch[7]='a'; ch[8]='n'; ch[9]='k'; int left[]= new int [10]; int j =0; for(int i =0;i