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

Problem: Holes ; Below is the code I am trying to execute but the compiler keeps giving me a WA . Could anyone help me find whats wrong ?

$
0
0
#include<iostream>
#include<string.h>

using namespace std;
int main()
    {
    int i,test,length; int count =0;
    char a[100];
    cin>>test;
    while(test--)
        {
        cin>>a;
            length=strlen(a);
            for(i=0;i<length;i++)
        {
            if(a[i]=='A'||a[i]=='D'||a[i]=='O'||a[i]=='P'||a[i]=='Q'||a[i]=='R')

                {
                    ++count;
                }

                if (a[i]== 'B')
                {
                   count= count + 2;
                }

        }
        }

        cout<<count ;
    }

Viewing all articles
Browse latest Browse all 40121

Trending Articles



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