Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

Holes in the text..wrong answer..please help

$
0
0

Can someone please tell me what is wrong with this code. It always shows a wrong answer. Thanx in advance..Below is the code : -

#include <iostream>
#include <cstring>
using namespace std;

int main() {
    int t,cnt;
    string s;
    const char * c;
    while(t!=0)
    {
    scanf("%s",&s);
    c=s.c_str();
    cnt=0;
    while((*c)!='\0')
     {
     if((*c)=='A'||(*c)=='D'||(*c)=='O'||(*c)=='P'||(*c)=='Q'||(*c)=='R')
       cnt++;
     if((*c)=='B')
       cnt+=2;
     *c++;
     };
     printf("%d\n",cnt);
    t--;
    };
    return 0;
}

Viewing all articles
Browse latest Browse all 39796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>