Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
why wa#include<iostream> using namespace std; char s[300]; int n; bool judge() { int i; if(s[0]>='A'&&s[0]<='Z') return 1; for(i=0;s[i]!='\0';i++) { if(s[i]=='_'&&(s[i+1]>='z'||s[i+1]<='a')) return 1; } return 0; } int main() { scanf("%s",s); int i; bool flag=0; if(judge()) { printf("Error!\n"); return 0; } for(i=0;s[i]!='\0';i++) { if(flag==1) { flag=0; continue; } if(s[i]=='_') { { printf("%c",s[i+1]-'a'+'A'); flag=1; } } else if(s[i]>='A'&&s[i]<='Z') { printf("_%c",s[i]-'A'+'a'); } else printf("%c",s[i]); } printf("\n"); system("pause"); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator