Statistics for Problems Related to Shortest Strings in Formal Languages