The confidence of an association rule $X \rightarrow Y$ is defined as
$$ \mathrm{confidence}(X\rightarrow Y) = P(Y \mid X) = \frac{P(X \wedge Y)}{P(X)}.$$
Here, $P$ denotes probability (also known as support in the context of association rules).
Let $\mathcal D$ denote the database of transactions $t$, where each transaction consists of a subset of items.
You can calculate $P(X)$ in the following way:
$$P(X) = \frac{\mid\{ t \in \mathcal D \mid X \subseteq t\}\mid}{\mid \mathcal D \mid}.$$
In your example output, there are $6$ transactions that contain both $A = 1$ and $B = 1$. This value is inherently the same for $\mathrm{confidence}(A = 1 \rightarrow B = 1)$ and $\mathrm{confidence}(B = 1 \rightarrow A = 1)$. Furthermore, there are $18$ transactions that contain $A = 1$ and $38$ transactions that contain $B = 1$.
These values result in $$\mathrm{confidence}(A = 1 \rightarrow B = 1) = \frac{6}{18} \approx 0.33$$ and $$\mathrm{confidence}(B = 1 \rightarrow A = 1) = \frac{6}{38} \approx 0.16.$$.