-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNOCODING.cpp
More file actions
32 lines (32 loc) · 750 Bytes
/
NOCODING.cpp
File metadata and controls
32 lines (32 loc) · 750 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <iostream>
#include <cstring>
using namespace std;
int main(){
int t;
cin>>t;
while (t--) {
string s;
cin>>s;
long long numberOfInstructions=2,n=s[0]-'a';
for (int i=1; i<s.size(); i++) {
long long k = s[i]-'a';
if(n<=k){
numberOfInstructions+= k - n;
n=k;
}
else{
numberOfInstructions+= (26+k) - n;
n=k;
}
numberOfInstructions+=1;
}
// cout<<numberOfInstructions<<" "<<11*s.size()<<"\t";
if(numberOfInstructions<= 11*s.size()){
cout<<"YES\n";
}
else{
cout<<"NO\n";
}
}
return 0;
}