#include using namespace std; const int nmax=1005; int lg,i,j; char a[nmax]; bool checked[nmax]; int trail (int poz) { int cars=0,h; for (h=poz;h