|
|
back to boardWA# 10. please help! my code //////////////////////////////// #include <stdio.h> int main() { char string[1000000]; int len=0; char ch; int count=0; int i; char temp; int nachalo=-1; int konec=-1; ch=getchar(); while(ch!=EOF) {
string[len]=ch; len++; ch=getchar(); } for(count=0;count<len;count++) { if(nachalo<0) if(((string[count]<='z')&&(string[count]>='a'))||((string[count]<='Z')&&(string[count]>='A'))) nachalo=count;
if(nachalo>-1) if(!(((string[count]<='z')&&(string[count]>='a'))||((string[count]<='Z')&&(string[count]>='A')))) konec=count-1; if (konec>-1) { for(i=nachalo;i<=nachalo+(konec-nachalo)/2;i++) { temp=string[i]; string[i]=string[konec-i+nachalo]; string[konec-i+nachalo]=temp; } nachalo=-1; konec=-1; } } for(i=0;i<len;i++) printf("%c",string[i]);
return 0; } Edited by author 14.08.2009 04:52 Re: WA# 10. please help! Your program doesn't work if the last symbol is any English letter, because there is no its "konec". |
|
|