http://codeforces.com/gym/101190/attachments
题意:
第一位大写,剩下小写的不小于两位的单词,
连续若干(大于等于两个)这样的单词连续(用空格间隔)可以把他们的首写字母提出来再来个空格加个括号把单词放括号里,其余不变,输出出来就行了
这字符串模拟乍一看挺简单的,坑也不少,细细体会吧QWQ
亮出丑爆的代码:
1 #include <stdio.h> 2 #include <string.h> 3 4 int judge_xiao(char ch) 5 { 6 if(ch>='a'&&ch<='z') return 1; 7 else return 0; 8 } 9 10 int judge_da(char ch) 11 { 12 if(ch>='A'&&ch<='Z') return 1; 13 else return 0; 14 } 15 16 int len, i, curb, curc, j, k; 17 int book[10005], book1[10005]; 18 char a[10005], b[10005][10005], c[10005][10005]; 19 20 int main() 21 { 22 freopen("abbreviation.in", "r", stdin); 23 freopen("abbreviation.out", "w", stdout); 24 while(gets(a)) 25 { 26 memset(book, 0, sizeof(book)); 27 memset(book1, 0, sizeof(book1)); 28 len = strlen(a); 29 curb = 0; 30 curc = 0; 31 32 for(i=0; i<len; i++) 33 { 34 j = 0; 35 while((judge_xiao(a[i])||judge_da(a[i]))&&i<len) 36 { 37 b[curb][j++] = a[i]; 38 i++; 39 } 40 b[curb][j] = '