Java Programmin
Programming and Technical
Programming
Technical
In the Byteland country a string “S” is said to super ASCII string if and only ifcount
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.
Read Solution (Total 7)
-
- #include
int number(char st[],char a,int i,int c);
int main( void ){
char st[400];
int v1=0,test,l=0;
int a[30];
char c1;
int pf=0;
int i;
scanf("%d",&test);
while(l!=test){
scanf("%s",&st);
for(i=0;i - 9 years agoHelpfull: Yes(3) No(0)
- #include
int number(char st[],char a,int i,int c);
int main( void ){
char st[400];
int v1=0,test,l=0;
int a[30];
char c1;
int pf=0;
int i;
scanf("%d",&test);
while(l!=test){
scanf("%s",&st);
for(i=0;i - 9 years agoHelpfull: Yes(1) No(0)
- hfasdfhliasdhf pearhgfipraohgflijsanf tj wqapoewhntoiqew; 9rqhepftraewij abtfiuewdbvoewar ewgfhijewrbv
- 9 years agoHelpfull: Yes(0) No(2)
- Sorry dude. Help yourself.
- 9 years agoHelpfull: Yes(0) No(0)
- import java.util.*;
class AsciiChecker
{
public static void main(String a[])
{
int i,count=0,j;
Scanner sc=new Scanner(System.in);
ArrayList result=new ArrayList();
int t=sc.nextInt();sc.nextLine();
if(t>=1 && t0)
{
String s=sc.nextLine();
char c[]=s.toCharArray();
if(s.length()>0 && s.length() - 9 years agoHelpfull: Yes(0) No(1)
- #include
#include
#include
int main()
{
char s[50]={' '};
int i=0,b,d=0,l;
gets(s);
l=strlen(s);
for(i=0;s[i]!=' ';i++)
{
s[i]-=96;
}
for(i=0;s[i]!=' ';i++)
{
for(b=0;s[b]!=' ';b++)
{
if(s[i]==s[b])
d++;
}
if(s[i]==d)
d=0;
else
{
printf("nNO");
break;
}
}
if((i)==l)
printf("Yes");
}
getch(); - 9 years agoHelpfull: Yes(0) No(2)
- This code You can use In python :
from collections import OrderedDict
n=input("Enter no. of Strings :")
#print n
li=[]
for j in range(1,n+1) :
li.append(raw_input("Enter String : ").lower())
#print li
#st="bbaccc".lower()
for st in li :
dic = {}
for i in set(st):
b = st.count(i, 0, len(st))
dic[i] = b
#print dic
od ="".join(OrderedDict.fromkeys(st).keys())
#print(od)
#print len(od)
c=0
for i in od :
#print "ascii of ",i," is ",ord(i)-96,"count : ",dic[i]
if (ord(i)-96)==dic[i] :
c +=1
if c==len(od) :
print st,"Yes"
else :
print st,"No" - 7 years agoHelpfull: Yes(0) No(1)
Java Programmin Other Question