#include <bits/stdc++.h>
int main()
{
std::ios::sync_with_stdio( false );
int n_string;
std::vector< std::string > strings;
std::cin >> n_string;
strings.resize( n_string );
for ( auto& a : strings )
{
std::cin >> a;
}
for ( auto& a : strings )
{
std::map< char, int > characters;
std::vector< int > n;
for ( char c = 'a'; c <= 'z'; ++c )
{
characters.insert( std::make_pair( c, 0 ) );
}
for( auto& c : a )
{
characters.at( c )++;
}
for( auto& b : characters )
{
if ( b.second == 0) continue;
n.push_back( b.second );
}
std::sort( n.begin(), n.end() );
bool dynamic = true;
for ( int i = 2; i < n.size(); ++i )
{
if ( n.at( i - 1 ) + n.at( i - 2 ) != n.at( i ) )
{
dynamic = false;
break;
}
}
if ( dynamic ) std::cout << "Dynamic" << std::endl;
else std::cout << "Not" << std::endl;
}
}
both “\n” and std::endl produces wrong answer…is for each not supported ? or is it something else and it is related to the output and input ?