#include<stdio.h>
#include<stdlib.h>
#include<string.h>
main()
{
char name[10][20];
int t,i,j,c=0;
scanf("%d",&t);
for(i=0;i<t;i++)
scanf("%s",name[i]);
for(i=0;i<t;i++)
strupr(name);
for(i=0;i<t;i++)
{
j=0;
while(name[i][j]!=’\0’)
{
if(name[i][j]==‘A’||name[i][j]==‘D’||name[i][j]==‘O’||name[i][j]==‘P’||name[i][j]==‘R’)
{
c=c+1;
j++;
}
else if(name[i][j]==‘B’)
{
c=c+2;
j++;
}
else
{
c=c+0;
j++;
}
//printf("%d",c);
}
printf("%d\n",c);
}
return 0;
}
The functions available in the string.h library are given here. Functions like strupr, strlwr, strrev, which are available in ANSI C (Turbo C/C++) are not available in standard C (gcc). Alternatively you can create your own custom method (see below) or approach the problem differently.
char *strupr(char *str)
{
int i;
int len = strlen(str);
for(i=0; i < len; i++)
str[i]=toupper((unsigned char)str[i]);
return str;
}
Hope this helps.
thank u so much