Public String Getopstring (int C)
{
StringBuffer SB = new stringbuffer ();
Random rnd = new random ();
INT PN, QN;
Pn = Qn = 0;
Char M;
Final char [] mm = new char [] {'p', 'q'};
While ((Qn PN) <(2 * c))
{m = mm [rnd.nextint (2)];
IF (m == 'p')
Pn ;
Else
Qn ;
IF (PN> C)
{Sb.append ('q');
PN -;
Qn ;
}
ELSE IF (pn == c)
sb.append (m);
Else
{
IF (qn> = c)
{
Sb.append ('p');
Qn--
Pn ;
} // if
Else
{IF (Qn> PN)
{sb.append ('p');
Qn--
Pn ;}
Else
sb.append (m);
} // else
} // else
} // while
String op = sb.toString ();
Return OP;
}