注意测试数据
1
2
/*hduacm
// abcd
结果是
1
/*hduacm
// ABCD
1 /* 1699 */ 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 const int maxn = 105; 45 const int maxl = 205; 46 char ss[maxl]; 47 char s[maxn * maxl]; 48 char d[maxn * maxl]; 49 int n, len; 50 51 void solve() { 52 int l = 0; 53 int i, j, k; 54 bool flag; 55 int ans = 0; 56 57 i = 0; 58 while (i < len) { 59 if (s[i]=='/' && s[i+1]=='*') { 60 j = i; 61 i += 2; 62 flag = false; 63 while (i < len) { 64 if (s[i]=='*' && s[i+1]=='/') { 65 flag = true; 66 i += 2; 67 break; 68 } 69 ++i; 70 } 71 72 if (flag) { 73 ++ans; 74 while (j < i) { 75 d[l++] = islower(s[j]) ? s[j]-'a'+'A' : s[j]; 76 ++j; 77 } 78 } else { 79 i = j; 80 d[l++] = s[i++]; 81 d[l++] = s[i++]; 82 } 83 84 } else if (s[i]=='/' && s[i+1]=='/') { 85 ++ans; 86 while (i<len && s[i]!=' ') { 87 d[l++] = islower(s[i]) ? s[i]-'a'+'A' : s[i]; 88 ++i; 89 } 90 } else { 91 d[l++] = s[i++]; 92 } 93 } 94 d[l] = '