Friends, I need to highlight specific letters. My set contains only A, N, C, Q and P, so I decided to make them look as a tape strip (ressembles a good old Turing Machine tape). The following code poorly tries to achieve that. Since I had an immutable set of letters and a defined order, I used the xstring package.
\documentclass{article}
\usepackage{tikz}
\usepackage{xstring}
\newcommand*\myblackbox[1]{%
\begin{tikzpicture}
\node[draw,inner sep=1pt, minimum height=0.2cm, minimum width=0.2cm] {\tiny\tt\raisebox{0pt}[\height][0pt]{#1}};
\end{tikzpicture}}
\newcommand*\mygraybox[1]{%
\begin{tikzpicture}
\node[draw,inner sep=1pt, draw=gray!60, minimum height=0.2cm, minimum width=0.2cm] {\color{gray!60}\tiny\tt\raisebox{0pt}[\height][0pt]{#1}};
\end{tikzpicture}}
\DeclareRobustCommand*\drawboxes[1]{%
\IfSubStr{#1}{A}{\myblackbox{A}}{\mygraybox{A}}%
\IfSubStr{#1}{N}{\myblackbox{N}}{\mygraybox{N}}%
\IfSubStr{#1}{C}{\myblackbox{C}}{\mygraybox{C}}%
\IfSubStr{#1}{Q}{\myblackbox{Q}}{\mygraybox{Q}}%
\IfSubStr{#1}{P}{\myblackbox{P}~}{\mygraybox{P}~}}
\begin{document}
\drawboxes{ACQ} Hello world.
\end{document}
This is the output:

The squares are arranged side by side. So far so good, but I'd like to make them slightly overlap each others, like this:

The black boxes have higher priority, so they need to be on top of the gray ones. My solution is very simple, so I understand that a possible solution might have another method.
Any ideas?

