Abelian and nonabelian groups with the same composition factors. I think I've answered the question in writing out my thoughts, but I'll share this nonetheless, not as a solution-verification question, but as an examples-counterexamples question.
This is Exercise 3.1.2 of Robinson's "A Course in the Theory of Groups (Second Edition)". According to this search, it is new to MSE.
The Details:
Since definitions vary, on page 15, ibid., paraphrased, it states that

A subgroup $N$ of $G$ is normal in $G$ if one of the following equivalent statements is satisfied:
(i) $xN=Nx$ for all $x\in G$.
(ii) $x^{-1}Nx=N$ for all $x\in G$.
(iii) $x^{-1}nx\in N$ for all $x\in G, n\in N$.

On page 28, ibid.,

A right operator group is a triple $(G, \Omega, \alpha)$ consisting of a group $G$, a set $\Omega$ called the operator domain and a function $\alpha:G\times \Omega\to G$ such that $g\mapsto (g,\omega)\alpha$ is an endomorphism of $G$ for each $\omega\in\Omega$. We shall write $g^\omega$ for $(g,\omega)\alpha$ and speak of the $\Omega$-group if the function $\alpha$ is understood.

On page 63, ibid.,

Let $G$ be an operator group with operator domain $\Omega$. An $\Omega$-series (of finite length) in $G$ is a finite sequence of $\Omega$-subgroups including $1$ and $G$ such that each member of the sequence is a normal subgroup of its successor: thus a series can be written
$$1=G_0\lhd G_1\lhd\dots\lhd G_l=G.$$
The [. . .] quotient groups $G_{i+1}/G_i$ are the factors of the series.

On page 64, ibid.,

If $\mathbf{S}$ and $\mathbf{T}$  are $\Omega$-series of [an $\Omega$-group] $G$, call $\mathbf{S}$ a refinement of $\mathbf{T}$ if every term of $\mathbf{T}$ is also a term of $\mathbf{S}$. If there is at least one term of $\mathbf{S}$ which is not a term of $\mathbf{T}$, then $\mathbf{S}$ is a proper refinement of $\mathbf{T}$.

On page 65, ibid.,

An $\Omega$-series which has no proper refinements is called an $\Omega$-composition series.
[. . .]
If $\Omega$ is empty, we speak of a composition series.

The Question:

Give an example of an abelian group and a nonabelian group with the same composition factors.

Thoughts:
Something tells me that the abelian group $A$ and the nonabelian group $G$ - if both finite - must have the same order. This is just a guess but it has guided my exploration of potential groups.
Looking at an extreme case, consider the smallest nonabelian group $G=S_3$. It has order $3!=6$. Thus compare $G$ to the only other group of order six, namely $A=\Bbb Z_6$. We have
$$1\lhd \Bbb Z_3\lhd G\tag{1}$$
and
$$1\lhd \Bbb Z_3\lhd A.\tag{2}$$
So far, so good; indeed:
$$G/\Bbb Z_3\cong \Bbb Z_2\cong A/\Bbb Z_3$$
and in both series $\Bbb Z_3/1\cong \Bbb Z_3$.
But something tells me this isn't right. Is it really so simple? I think I have made a stupid mistake somewhere.
Have I even got the quotients right?
Besides, I'd like a more systematic approach to the exercise than my half-baked heuristics above, please.
 A: In the interest of providing an answer, let me agree with Arturo that "it really is that simple."
In the interest of providing a nontrivial answer, let me say a bit more about more systematic approaches. I'll give two ways that people study this: one algebraic and one geometric.

First, the algebraic answer:
Say you have two groups $G$ and $A$, which we want to glue into a bigger group $E$. For simplicity, let's assume that $A$ is abelian and that $A$ will actually live in the center of $E$ (so that the eventual conjugation action on $A$ is trivial). Both of these assumptions can be relaxed with a bit of work, but they make the discussion much simpler. Since $A$ lives in the center of $E$, we call this a central group extension of $G$ by $A$. Formally, we get an exact sequence:
$$1 \to A \to E \to G \to 1$$
At the end of the day, we'll have (as underlying sets) $E = A \times G$, and our task is to put some group structure on this which is compatible with $A$ and $G$.
What data do we need in order to build such a group structure? In the noncentral case, we need to know how elements of $A$ behave when we conjugate by elements of $G$ (since $A$ should end up being normal in $E$). But (again) we're ignoring that subtlety by assuming the conjugation action is trivial.
It turns out the important data that's left is a map $c : G \times G \to A$ which tells us if we pick up a factor of $A$ when we multiply two elements of $G$. You should think of this as a kind of "carry", where when we multiply two elements in the "$G$-place", we might overflow into the "$A$-place". In fact, this can be made precise.
With this in hand, we can define a group structure on $A \times G$ by
$$(a_1, g_1) (a_2, g_2) = (a_1 + a_2 + c(g_1,g_2),\ g_1 g_2).$$
If you chase through the assumptions on $c$ in order to make this satisfy the group laws, you'll find yourself with only one restriction that comes from associativity.
Rather magically, this condition is exactly the "cocycle condition" from
cohomology theory! This gives us a (very surprising) isomorphism
$$\{ \text{central extensions $E$} \} \longleftrightarrow H^2(G,A)$$
where $H^2(G,A)$ is the second cohomology group of $G$ with coefficients in $A$ (if we want the extension to be noncentral, all we do is view $A$ as a $G$-module by our desired conjugation action. For this post, though, $A$ has trivial $G$-module structure).
Depending on how familiar you are with cohomology theories, this may look like a fearsome object once you start looking into the definition. But just like it's tedious (but not difficult) to compute the derivative of some disgusting function, it's tedious (but not difficult) to compute the cohomology of many groups (once you get some practice). In fact, programs like GAP and Sage can compute the cohomology of fintie groups (and some infinite groups) for you! See here for more info.
So you can get a good handle on the possible group extensions by understanding the cohomology of the group you want to be the quotient. There's lots to say about this connection, but for two good references you might try Chapter $7$ of Rotman's Introduction to the Theory of Groups or Chapter $4$ of Brown's Cohomology of Groups.

Now for the geometric angle (pun not intended).
There's an "obvious" way to glue two groups $G$ and $H$ together in "an abelian way": simply take the direct product $G \times H$. Even when $G$ and $H$ aren't abelian, they commute with each other inside of $G \times H$. We can represent this by just taking the product of the cayley graphs of $G$ and $H$ in the naive way. For your example of $\mathbb{Z} / 2 \times \mathbb{Z} / 3$, we get:
.
Notice here we have a $\mathbb{Z}/2$ quotient, and the "fibres" of this map are copies of $\mathbb{Z} / 3$. Moreover, we've glued the fibres together in the most natural way.
It turns out that noncentral extensions look like this, but we "twist" the fibres according to the action of the to-be-quotient group on the to-be-normal group. For example, if we look at the cayley graph of $S_3$, we get the same picture, but the second fibre has its edges flipped the other way (since that's what the $\mathbb{Z} / 2$ action does to it. See here:

Sorry this is drawn from a different angle from the other one. I'm supposed to be grading right now, and don't have time to draw pictures of my own, haha. These were both taken from a (characteristically excellent) blog post by Terry Tao where you can read more.
The idea, though, is that the action of $G$ on $H$ gives us a twisting of the fibres of the extension $1 \to H \to E \to G \to 1$. So if we want to understand extensions, we can gain insight through this geometric approach. You can read more at the linked blog post, but I don't have any textbook references on hand. Hopefully a kind soul will one day provide one in the comments.

It turns out these two approaches (as written in this post) are complementary. In the algebraic approach, we assumed the action of $G$ on $A$ was trivial, whereas in the geometric approach we (implicitly) assumed the cocycle $G \times G \to A$ was trivial. I mentioned that we can consider nontrivial actions using cohomology, and it turns out geometric techniques can also apply to nontrivial cocycles (see the blog post).
Both approaches, though, give a more systematic way to study the groups that you get by taking group extensions. Obviously you can iterate this procedure (starting with simple groups) in order to get groups which have the same composition factors. Though, just as obviously, the complexity blows up immediately when you try to do it for more than two or three factors.

I hope this helps ^_^
