×

# HOLES in the text

 0 Hi Guys I've recently started solving question on code-chef and this Holes in my text is only third problem which I solved, The question says that Chef wrote some text on a piece of paper and now he wants to know how many holes are in the text. What is a hole? If you think of the paper as the plane and a letter as a curve on the plane, then each letter divides the plane into regions. For example letters "A", "D", "O", "P", "R" divide the plane into two regions so we say these letters each have one hole. Similarly, letter "B" has two holes and letters such as "C", "E", "F", "K" have no holes. We say that the number of holes in the text is equal to the total number of holes in the letters of the text. Help Chef to determine how many holes are in the text. Input The first line contains a single integer T <= 40, the number of test cases. T test cases follow. The only line of each test case contains a non-empty text composed only of uppercase letters of English alphabet. The length of the text is less then 100. There are no any spaces in the input. So are we not supposed to validate that T must be less than 40 and each string be non-empty contaning of only upper case characters in the problem, cause i looked at some of the solution to the problem and none if them did these validation, So are we supposed to validate the input data or not and Here is my code It is giving the correct o/p for sample test cases but it is not accepted as the right answer, Can anyone review the code #include int main() { int test_times,j=0,lower=1; scanf("%d",&test_times); if(test_times<=40) { int i,y; char holes[test_times][100]; for(i=0;i=65&&holes[i][j]<=91)) { lower=0; break; } } } if(lower) { for(i=0;i

 0 Take a look at letter Q :) answered 19 Mar '15, 16:30 7★lebron 3.3k●3●17 accept rate: 24% I didn't get it :) (19 Mar '15, 17:36)
 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,491
×355

question asked: 19 Mar '15, 16:24

question was seen: 2,687 times

last updated: 20 Mar '15, 10:14