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').
1
Expert's answer
2015-08-04T02:29:28-0400
Answer
#include <iostream> #include <map> #include <vector> using namespace std;
int main() { int t; cout<<"Enter the number of cases: "; cin>>t; cin.ignore(7777,'\n'); for (int i=0;i<t;i++) { string str; bool b=1; getline(cin,str); map<char, int>s; vector<char>vc; for (auto c:str) { s[c]++; if (s[c]==1) vc.push_back(c); } for (auto c:vc) { if (s[c]!=int(c)-96) b=0; } if (b) cout<<"Yes"<<endl; else cout<<"No"<<endl; } }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
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
Leave a comment