awk '{print gsub(/\"\|\"/,"&",$0)}' input.txt
Prints number of substitutions of "|"
i.e count of it, so
awk '{print gsub(/\"\|\"/,"&",$0) +1 }' input.txt
Will be number of columns.
"&"
means substitute the matched string with itself, i.e no change.
EDIT
Or use
awk -F'["][|]["]' '{print NF}' input.txt
Which prints number of columns and this
awk -F'["][|]["]' '{print NF-1}' input.txt
is the number of "|"