Last active
January 3, 2016 16:09
-
-
Save nebuta/8487453 to your computer and use it in GitHub Desktop.
Is (´・_・`((´・_・`)´・_・`)) a copy-and-paste of (´・_・`)?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> | |
#include <iostream> | |
using namespace std; | |
bool failed = false; | |
int pos = 0; | |
string s; | |
string seq = "ABCDCba"; | |
void sub(){ | |
//printf("%d\n",pos); | |
if(s[pos] != seq[0]){ | |
//printf("failed at %d\n",pos); | |
failed = true; | |
return; | |
} | |
int c, accum = 0; | |
pos++; | |
for(int c = 1; c < 7;){ | |
if(s[pos+accum] == seq[0]){ | |
pos += accum; | |
accum = 0; | |
sub(); | |
}else{ | |
if(s[pos+accum] == seq[c]){ | |
c++; | |
accum++; | |
//printf("%d\n",accum); | |
}else{ | |
failed = true; | |
//printf("failed at (%d,%d)\n",pos,c); | |
return; | |
} | |
} | |
} | |
pos += accum; | |
//printf("%d\n",pos); | |
} | |
bool run() { | |
int len = s.length(); | |
//printf("%d\n",len); | |
do{ | |
sub(); | |
//printf("After sub(): %d\n",pos); | |
}while(pos < len-1 && !failed); | |
return !failed; | |
} | |
int main(){ | |
cin >> s; | |
bool r = run(); | |
if(r){ | |
puts("YES"); | |
}else{ | |
puts("NO"); | |
} | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment