結果 : function to count characters in python