Let $G$ be a finite non-abelian $p$-group, where $p$ is a prime. An automorphism $\alpha$ of $G$ is called a class-preserving if for each $x\in G$, there exists an element $g_x\in G$ such that $\alpha(x)=g_x^{-1}xg_x$. An automorphism $\alpha$ of $G$ is called a $2$nd class-preserving if for each $x\in G$, there exists an element $g_x\in G'$ such that $\alpha(x)=g_x^{-1}xg_x$. Let $Aut_c(G)$ and $Aut_{c}^2(G)$ respectively denote the group of all class-preserving and $2$nd class-preserving automorphisms of $G$. I have make a GAP program to find the structure of $Aut_c(G)$ but i am fail to make a GAP program to find the structure of $Aut_{c}^2(G)$. My question is the following:Can anybody help me to make a GAP program to find the structure of $Aut_{c}^2(G)$?