F. 01 Game
Problem
Alica and Bob are playing a game.
Initially they have a binary string s s s consisting of only characters 0 and 1.
Alice and Bob make alternating moves: Alice makes the first move, Bob makes the second move, Alice makes the third one, and so on. During each move, the current player must choose two different adjacent characters of string s s s and delete them. For example, if s = 1011001 s = 1011001 s=1011001 then the following moves are possible:
- delete s 1 s_1 s1 and s 2 s_2 s2: 10 11001 → 11001 \textbf{10}11001 \rightarrow 11001 1011001→11001;
- delete s 2 s_2 s2 and s 3 s_3 s3: 1 01 1001 → 11001 1\textbf{01}1001 \rightarrow 11001 1011001→11001;
- delete s 4 s_4 s4 and s 5 s_5 s5: 101 10 01 → 10101 101\textbf{10}01 \rightarrow 10101 1011001→10101;
- delete s 6 s_6 s6 and s 7 s_7 s7: 10110 01 → 10110 10110\textbf{01} \rightarrow 10110 1011001→10110.
If a player can’t make any move, they lose. Both players play optimally. You have to determine if Alice can win.
Input
First line contains one integer t t t ( 1 ≤ t ≤ 1000 1 \le t \le 1000 1≤t≤1000) — the number of test cases.
Only line of each test case contains one string s s s ( 1 ≤ ∣ s ∣ ≤ 100 1 \le |s| \le 100 1≤∣s∣≤100), consisting of only characters 0 and 1.
Output
For each test case print answer in the single line.
If Alice can win print DA (YES in Russian) in any register. Otherwise print NET (NO in Russian) in any register.
Example
Input
3
01
1111
0011
Output
DA
NET
NET
Note
In the first test case after Alice’s move string s s s become empty and Bob can not make any move.
In the second test case Alice can not make any move initially.
In the third test case after Alice’s move string s s s turn into 01 01 01. Then, after Bob’s move string s s s become empty and Alice can not make any move.
Code
// #include <iostream>
// #include <algorithm>
// #include <cstring>
// #include <stack>//栈
// #include <deque>//堆/优先队列
// #include <queue>//队列
// #include <map>//映射
// #include <unordered_map>//哈希表
// #include <vector>//容器,存数组的数,表数组的长度
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve()
{
string s;
cin>>s;
ll x=0;
for(auto &t:s)
{
if(t=='0') x++;
}
ll mn=min(x,ll(s.size()-x));
if(mn&1) cout<<"DA"<<endl;
else cout<<"NET"<<endl;
}
int main()
{
ll t;
cin>>t;
while(t--) solve();
return 0;
}