Error!
====================================================================================================================
#include<stdio.h> #include<string.h> int main() { char str[101]; gets(str); int i,flag[2]={0},error[2]={0}; if((str[0]>=97)&&(str[0]<=122)&&str[strlen(str)-1]!='_') { for(i=0;i<strlen(str);i++) { if(str[i]=='_') { flag[1]=1; if(str[i-1]=='_'||str[i+1]=='_') error[1]=1; } if(65<=str[i]&&str[i]<=90) { flag[0]=1; } } //c++ to java if(flag[1]==1&&flag[0]==0&&error[1]==0) { for(i=0;i<strlen(str);i++) { if(str[i]=='_'&&(str[i+1]!='_')) { if(i<strlen(str)){ str[i+1]-=32; continue;} } else if(str[i]=='_'&&(str[i+1]=='_')) {printf("Error!");} else printf("%c",str[i]); } } //java to c++ else if(flag[0]==1&&flag[1]==0&&error[0]==0) { for(i=0;i<strlen(str);i++) { if(65<=str[i]&&str[i]<=90) { printf("_%c",str[i]+32); } else printf("%c",str[i]); } } else if(flag[0]==0&&flag[1]==0) { printf("%s",str); } else { printf("Error!"); } } else { printf("Error!"); } //printf("\n"); return 0; }