bool read(LIST& v) { static int ch; if ((ch = getchar()) == EOF) { return false; } v.clear(); while (ch != '\n') { ungetc(ch, stdin); scanf("%d", &ch); v.push_back(make_pair(ch, (int)v.size())); ch = getchar(); } return true; }
void write(const LIST& v) { for (int i = 0; i < (int)v.size(); ++i) { printf("%s%d", i == 0 ? "" : " ", v[i].first); } puts(""); }