We used the argument given in the proof below in a couple of problems, and I am asking if it works generally and to what extent we can generalize it.
The proposed statement:
Let A and B be commutative rings with identity such that $$ \mathcal{A} := \prod_{i=1}^{s} A/p_i^{n_i} \cong \prod_{j=1}^{t} B/q_j^{m_j} =: \mathcal{B}, $$ where the $p_i$'s and $q_j$'s are nonzero disticint prime ideals of A and B, respictively. Then $s=t$, $n_i = m_i$, and $A/p_i^{n_i} \cong B/q_i^{m_i}$.
Proof:
$\mathcal{A}$ has s maximal ideals, namely $\{(p_1,1, \dots,1)(1, p_2, \dots,1), \dots, (1,1, \dots,p_s)\}$. Similarily, $\mathcal{B}$ has $t$ maximal ideals, then $s=t$.
The image of $A/p_i^{n_i}$ is an ideal of $B$, so it is of the form $$ \prod_{j=1}^{t} B/q_{j}^{m_{j_i}}, $$ whwere $ 0 \leq m_{j_i} \leq m_i$. Since $A/p_i^{n_i}$ has a unique maximal ideal, then we must have only one compoant of the product, $B/q_1^{m_{1_i}} $, say. Now, $A/p_i^{n_i}$ has $n_i-1$ nonzero ideals, then $m_{1_i} = n_i$. Hence, after renumbering, we have $$ A/p_i^{n_i} \cong B/q_i^{n_i}. $$