You are not logged in. Please login at www.codechef.com to post your questions!

×

holes in the text ..why it is showing wrong answer??

import java.util.*; class MAIN { public static void main(String[] args) {

Scanner obj=new Scanner(System.in);
int k=obj.nextInt();

String m[]=new String[k]; int m2[]=new int[k];

int z=0;
for(int i=0;i<=k-1;i++) m[i]=obj.next();

for(int i=0;i<=k-1;i++) { z=0; for(int j=0;j<=m[i].length()-1;j++) { if(m[i].charAt(j)=='A' || m[i].charAt(j)=='D' || m[i].charAt(j)=='O' || m[i].charAt(j)=='P'|| m[i].charAt(j)=='R') { ++z;
m2[i]=z;
}

if(m[i].charAt(j)=='B')
{
z=z+2;
    m2[i]=z;
}

} }

for(int i=0;i<=k-1;i++) System.out.println(m2[i]);

}

}

asked 16 Oct '14, 00:05

yash_5's gravatar image

0★yash_5
212
accept rate: 0%


'Q' also has one hole!

link

answered 16 Oct '14, 01:38

pranjalranjan's gravatar image

4★pranjalranjan
2.0k21432
accept rate: 20%

1

thanx pranjalranjan.. :-)

(16 Oct '14, 22:41) yash_50★
-1

Please accept the answer once you got what you have got what you needed!!

Happy Coding

link

answered 16 Oct '14, 08:51

bipin2's gravatar image

3★bipin2
3.1k254671
accept rate: 8%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • 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:

×138
×30
×24
×19
×16
×1
×1

question asked: 16 Oct '14, 00:05

question was seen: 524 times

last updated: 16 Oct '14, 22:41