fork download
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. int main() {
  6. string w;
  7. cin >> w;
  8. int n = w.size();
  9. vector <string> fib;
  10. fib.push_back("b");
  11. fib.push_back("a");
  12. int dl = 1;
  13. int i = 2;
  14. while(dl < n){
  15. string napis = "";
  16. napis += fib[i-1];
  17. napis += fib[i-2];
  18. fib.push_back(napis);
  19. dl = fib[i].size();
  20. i++;
  21. }
  22. if(fib[dl] == w || fib[dl-1] == w){
  23. cout << "TAK";
  24. }else{
  25. cout << "NIE";
  26. }
  27. return 0;
  28. }
Success #stdin #stdout 0.01s 5304KB
stdin
abaa
stdout
NIE