n 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.
1
Expert's answer
2015-08-04T02:35:33-0400
Solve #include <iostream>
int main() { char str[100]; std::cout<<"Input string: "; std::cin>>str;
int i=0; //calculate number of symbols: int numbers[26]={0}; while(str[i]!='\0') { if((str[i]>='a')&&(str[i]<='z')) numbers[str[i]-'a']++; i++; } //check numbers and number in super ascii: int isAscii=1; for(i=0;i<26;i++) if((numbers[i]>0)&& (numbers[i]!=(i+1))) { isAscii=0; break; } if(isAscii==0) std::cout<<"No"; else std::cout<<"Yes";
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments