#include <iostream>
#include <stdio.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <map>
#include <string>
#include <string.h>
#include <set>
#include <queue>
#include <algorithm>
#include <sstream>
using namespace std;
typedef long long LL ;
char word[10008] ;
std::map<std::string , int> Id ;
int id ;
int getId(std::string s){
if(Id.find(s) == Id.end()) return Id[s] = ++id ;
return Id[s] ;
}
std::set<std::pair<int,int> >AtoB ;
bool can[108][108] ;
int gao(std::string s){
int n = s.length() ;
if((n % 2) != 0) return 0 ;
if(s == "he") return 0 ;
for(int i = 0 ; i < n ; i++){
if(i&1){
if(s[i] != 'e') return 0 ;
}
else{
if(s[i] != 'h') return 0 ;
}
}
return 1 ;
}
int main(){
Id.clear() ;
id = 0 ;
AtoB.clear() ;
memset(can , 0 , sizeof(can)) ;
while(gets(word)){
int n = strlen(word) ;
for(int i = 0 ; i < n ; i++){
if('A' <= word[i] && word[i] <= 'Z') word[i] = word[i] - 'A' + 'a' ;
else if('a' <= word[i] && word[i] <= 'z'){}
else word[i] = ' ' ;
}
std::string s = std::string(word) ;
std::istringstream st(s) ;
std::string na ;
int A , B ;
int i = 0 ;
while(st >> na){
++i ;
if(i == 1) A = getId(na) ;
else if(i == 2){
B = getId(na) ;
if(A > B) std::swap(A, B) ;
AtoB.insert( std::make_pair(A , B) ) ;
can[A][B] = 0 ;
}
else can[A][B] |= gao(na) ;
}
}
double mu = AtoB.size() ;
double zi = 0 ;
for(std::set<std::pair<int ,int> >::iterator it = AtoB.begin() ; it != AtoB.end() ; it++){
if(can[it->first][it->second]) zi += 1.0 ;
}
printf("%.0lf%%\n" , zi / mu * 100.0) ;
return 0 ;
}