Test instructions mishap, look at examples to understand! Actually is a simulation problem, did not expect no parentheses can not appear in the middle, beep the dog!
#include <stdio.h>#include<iostream>#include<algorithm>#include<string.h>#include<string>#include<stdlib.h>using namespacestd;Chars[ the];Charans[3][ the];Charchu[ the];Chardou[3];intMain () {inti; Gets (s); intL=strlen (s); memset (Chu,0,sizeof(CHU)); intk=0, xl=0; for(i=0; i<l;i++) { if(s[i]=='{') { intj=0; I++; while(i!=l&&s[i]!='}') {ans[0][j++]=S[i]; I++; } ans[0][j++]=' '; ans[0][j]=' /'; } Else if(s[i]=='(') { intj=0; I++; while(i!=l&&s[i]!=')') {ans[1][j++]=S[i]; I++; } ans[1][j++]=' '; ans[1][j]=' /'; } Else if(s[i]=='[') { intj=0; I++; while(i!=l&&s[i]!=']') {ans[2][j++]=R[i]; I++; } ans[2][j]=' /'; } Else if(s[i]==',') {dou[0]=','; dou[1]=' '; strcat (chu,ans[0]); strcat (chu,ans[1]); strcat (chu,ans[2]); strcat (Chu,dou); I++; XL=strlen (CHU); intk=XL; while(i!=l&&s[i]!='['&&s[i]!='('&&s[i]!='{') {chu[k++]=S[i]; I++; } I--; memset (ans,0,sizeof(ans)); }} strcat (chu,ans[0]); strcat (chu,ans[1]); strcat (chu,ans[2]); XL=strlen (CHU); for(i=0; i<xl;i++) { if(i==0) { if(chu[i]<='Z'&&chu[i]>='a') Chu[i]=chu[i]- +; } Else { if(chu[i]<='Z'&&chu[i]>='A') Chu[i]=chu[i]+ +; }} printf ("%s\n", Chu); return 0;}
D-this Cheeseburger You don ' t need (URAL1993)