TCS Codevita 13 august 2014
Programming and Technical
Category
this can be asked in any language
Q)In the Byteland country a string "S" is said to super ascii string if and only if count of each character in the string is equal to its ascii value.
In the Byteland country ascii code of 'a' is 1, 'b' is 2 ...'z' is 26.
Your task is to find out whether the given string is a super ascii string or not.
Input Format:
First line contains number of test cases T, followed by T lines, each containing a string "S".
Output Format:
For each test case print "Yes" if the String "S" is super ascii, else print "No"
Constraints:
1<=T<=100
1<=|S|<=400, S will contains only lower case alphabets ('a'-'z').
Sample Input and Output
SNo. Input Output
1
2
bba
scca
Yes
No
Explanation:
In case 1, viz. String "bba" -
The count of character 'b' is 2. Ascii value of 'b' is also 2.
The count of character 'a' is 1. Ascii value of 'a' is also 1.
Hence string "bba" is super ascii.
Read Solution (Total 12)
-
- #include
#include
#define size 100
void main()
{
char str[size];
int flag=0;
int count=0;
int counttobe=0;
int i,j;
cout>str;
for(i=0;str[i]!=' ';i++)
{
count=0;
counttobe=(int)(str[i]-96);
for(j=0;str[j]!=' ';j++)
{
if(str[i]==str[j])
{
count++;
}
}
if(count != counttobe)
{
flag=1;
break;
}
}
if(flag==0)
{
cout - 10 years agoHelpfull: Yes(3) No(3)
- //V#
#include
void main()
{ while(1){
int i=0,c,n=0,t[100],f=1;
char s[100];
printf("enter String");
gets(s);
for(i=0;s[i]!=NULL;i++)
{ t[i]=s[i]-96;n++;}
for(i=0;i - 9 years agoHelpfull: Yes(1) No(0)
- enum str{a=1,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z};
int main()
{
int tc,num=1;
enum str ss;
scanf("%d",&tc);
while(num= 'a' && string[co] - 9 years agoHelpfull: Yes(1) No(0)
- t=input("")
line=[]
if(t>=1 and t - 9 years agoHelpfull: Yes(0) No(0)
- plz,give a proper coding for this question
- 9 years agoHelpfull: Yes(0) No(1)
- i cant understand
pls give complete coding
- 9 years agoHelpfull: Yes(0) No(0)
- enum str{a=1,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z};
int main()
{
int tc,num=1;
enum str ss;
scanf("%d",&tc);
while(num= 'a' && string[co] - 9 years agoHelpfull: Yes(0) No(0)
Conversation opened. 1 read message.
Skip to content
Using Gmail with screen readers
Cse
More
1 of 30
SuperAsciiString
Inbox
x
Cse Rockers
Attachments3:25 PM (19 hours ago)
to me
Attachments area
Preview attachment FIRST.C
[C]
Click here to Reply or Forward
0.12 GB (0%) of 15 GB used
Manage
Terms - Privacy
Last account activity: 10 minutes ago
Open in 1 other location Details
FIRST.C
#include
#include
#include
int main()
{
char str[100];
int i,j,k,count=1;
clrscr();
scanf("%s",str);
for(i=0;i- 9 years agoHelpfull: Yes(0) No(0)
- #include
#include
#include
int main()
{
char str[100];
int i,j,k,count=1;
clrscr();
scanf("%s",str);
for(i=0;i - 9 years agoHelpfull: Yes(0) No(0)
- #include
int main()
{
char str[400];
int res[100]={0};
int T;
scanf("%d",&T);
int j;
for(j=0;j='a')&&(str[i] - 9 years agoHelpfull: Yes(0) No(1)
- #include
int main()
{
char str[400]; //for input line
int res[100]={0}; //result of check
int T;
printf("Input number of string: ");
scanf("%d",&T);
int j;
for(j=0;j='a')&&(str[i] - 9 years agoHelpfull: Yes(0) No(1)
- import java.util.*;
import java.io.*;
class supers{
public static void main(String args[])throws IOException{
Scanner scan=new Scanner(System.in);
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("no of test cases:");
int i,j,k,count=0,nmbr=0,c=0,mam=0;
int num=scan.nextInt();
char ch;
String str[]=new String[num];
char chh[]=new char[27];
for(i=0;i - 8 years agoHelpfull: Yes(0) No(1)
TCS Codevita 13 august 2014 Other Question