if you want a function to work in CPP and blueprint, try this:
in the editor, go to file> add code to project, and make a new class based off HUD called myHud.
//inside the myHud.h class, between the brackets add:
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "MyStuff")
FString getWords( FString Word1, FString Word2 );
//at the end of the myHud.CPP file, after the brackets add:
FString myHud::getWords_Implementation( FString Word1, FString Word2 )
{
return Word1;
}