#include <stdio.h> #include <string.h> #include <ctype.h> // 检查输入字符串是否合法 int OK(char *s) { int len = strlen(s); // 检查长度是否合法(2 或 3) if (len != 2 && len != 3) return 1; // 检查第一个字符是否为 'A', 'D', 'W', 'S' if (s[0] != 'A' && s[0] != 'D' && s[0] != 'W' && s...