×

# Holes in Text Wrong Answer

 0 I am using the below code to solve the HOLES in the TEXT problem, I am getting the expected o/p, but Its is not accepting the answer, I have checked the other solutions also they have the same logic as mine, But I don't know why my solution is not being accepted. Please help me out here This is my code which i have used #include int main(void) { int test; scanf("%d",&test); while(test--) { char str[100]; int holes=0; scanf("%s",str); int i; for(i=0;str[i]!='\0';++i) { if(str[i]=='A'||str[i]=='D'||str[i]=='O'||str[i]=='P'||str[i]=='R'||str[i]=='Q') ++holes; if(str[i]=='B') holes=holes+2; } printf("%d",holes); } }  asked 24 Mar '15, 17:13 5●1●2 accept rate: 0%

 0 You need to print each output ( number of holes ) at a new line. Change the line printf("%d",holes); to printf("%d\n",holes); and it will be accepted. Check your accepted code with the above modification here. answered 24 Mar '15, 17:21 1.1k●3●13 accept rate: 36% Thanks, feeling embarrassed I should be more careful before posting. (24 Mar '15, 17:26) Don't worry, small points like these sometimes get overlooked. We all make silly mistakes quite often, this makes us human. (24 Mar '15, 17:33)
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×1,488
×354
×191

question asked: 24 Mar '15, 17:13

question was seen: 541 times

last updated: 24 Mar '15, 17:33