PE的注意,如果没有满足条件的不输出空格。
简单模拟,暴力解。
1 /* */ 2 #include <iostream> 3 #include <sstream> 4 #include <string> 5 #include <map> 6 #include <queue> 7 #include <set> 8 #include <stack> 9 #include <vector> 10 #include <deque> 11 #include <bitset> 12 #include <algorithm> 13 #include <cstdio> 14 #include <cmath> 15 #include <ctime> 16 #include <cstring> 17 #include <climits> 18 #include <cctype> 19 #include <cassert> 20 #include <functional> 21 #include <iterator> 22 #include <iomanip> 23 using namespace std; 24 //#pragma comment(linker,"/STACK:102400000,1024000") 25 26 #define sti set<int> 27 #define stpii set<pair<int, int> > 28 #define mpii map<int,int> 29 #define vi vector<int> 30 #define pii pair<int,int> 31 #define vpii vector<pair<int,int> > 32 #define rep(i, a, n) for (int i=a;i<n;++i) 33 #define per(i, a, n) for (int i=n-1;i>=a;--i) 34 #define clr clear 35 #define pb push_back 36 #define mp make_pair 37 #define fir first 38 #define sec second 39 #define all(x) (x).begin(),(x).end() 40 #define SZ(x) ((int)(x).size()) 41 #define lson l, mid, rt<<1 42 #define rson mid+1, r, rt<<1|1 43 44 // #define DEBUG 45 46 const int maxp = 55; 47 const int maxt = 255; 48 const int maxl = 255; 49 const int maxn = 305; 50 const int INF = 0x3f3f3f3f; 51 int M[maxn], mn; 52 int M_[maxn], mn_; 53 map<string,int> tb; 54 map<string,int>::iterator iter; 55 int wc = 0, pn = 1, tn = 1; 56 char s[maxl]; 57 58 typedef struct { 59 int l; 60 char s[maxl]; 61 62 void init() { 63 int id; 64 int len = strlen(s); 65 int i = 0, j; 66 67 mn = 0; 68 while (i < len) { 69 if (isspace(s[i])) { 70 ++i; 71 continue; 72 } 73 j = i; 74 while (i<len && islower(s[i])) 75 ++i; 76 s[i] = '