weight (strings)
Let $A$ be an alphabet, $a\in A$ a letter from $A$ and $c\in {A}^{*}$ a string over $a$. Then the $a$weight of $c$, denoted by ${\mathrm{wt}}_{a}(c)$, is the number of times $a$ occurs in $c$.
If $A$ is an abelian group^{}, the Hamming weight $\mathrm{wt}(c)$ of $c$ (no ), often simply referred to as “weight”, is the number of nonzero letters in $c$.
Examples

•
Let $A=\{x,y,z\}$. In the string $c:=yxxzyyzxyzzyx$, $y$ occurs $5$ times, so the $y$weight ${\mathrm{wt}}_{y}(c)=5$.

•
Let $A={\mathbb{Z}}_{3}=\{0,1,2\}$ (an abelian group) and $c:=002001200$. Then ${\mathrm{wt}}_{0}(c)=6$, ${\mathrm{wt}}_{1}(c)=1$, ${\mathrm{wt}}_{2}(c)=2$ and $\mathrm{wt}(c)={\mathrm{wt}}_{1}(c)+{\mathrm{wt}}_{2}(c)=3$.
Title  weight (strings) 

Canonical name  Weightstrings 
Date of creation  20130322 15:13:17 
Last modified on  20130322 15:13:17 
Owner  GrafZahl (9234) 
Last modified by  GrafZahl (9234) 
Numerical id  6 
Author  GrafZahl (9234) 
Entry type  Definition 
Classification  msc 94A55 
Synonym  weight 
Related topic  KleeneStar 
Defines  Hamming weight 