for (int x = 0; x < cPhrase.length(); x++) { if (cPhrase.charAt(x) == ' ') gPhrase += cPhrase.charAt(x) == ' '? ' ' : '?'; }