I think, u still cant get.. ok, lets compare the following two almost the same programs. Using gets()... [c]char a[100]; int i; while(gets(a)) { for(i=0;a ;i++) printf("%c",a ); printf("\n"); }[/c] Using scanf()... [c]char a[100],ch; int i; while(scanf("%s%c",a,&ch...
Caesum wrote:...... there are 2 ways around it that I used to use:
1. Only use small arrays when testing, and a larger array for submission.
2. Allocate arrays with malloc.
Yes, these are the ways, I think.
And if you use Ms. VC++, you'll able to get all the properties of the UVA Judge Comliler.
turuthok, look ... [c]while(scanf("%s%c",a,&ch)==2) { } [/c] here, the single word is stroed in a[] and the next non-alphabet(digit, space, newline etc.) is stored in ch. and u can do the loop word by word and after completing each loop, jst print the ch variable.. which stored a non-a...
It's so easy problem. Check your code ... debug it.
it's also easy to find out inputs and outputs for this problem. so, find some others inputs and calculate the output urself 1st.. then check with ur program...
Hello turuthok, i failed to describe it,, i meant, instead of this code: [c]while(gets(a)) { ... ... .....printf("%c",a ); } printf("\n"); [/c] we can also use this... [c]while(scanf("%s%c",a,&ch)==2) { ... ... ... .....prinft("%c",a ); } printf("%c&...