#define _GLIBCXX_DEBUG #include using namespace std; #define rep(i, n) for (int i = 0; i < (ll)(n); i++) #define all(a) (a).begin(), (a).end() using ll = long long; const int INF32 = 2e9; const ll INF64 = 4e18; const ll MOD = 998244353; ll power26(int x){ ll res = 1; for(int i = 0; i < x; i++){ res*=26; res%=MOD; } return res; } ll BFS(ll now, int depth, int questioncnt,vector> G,string S, vector seen){ if(depth==0&&!(S[now]=='a'||S[now]=='?')){ return 0; } if(depth==1&&!(S[now]=='o'||S[now]=='?')){ return 0; } if(depth==2&&!(S[now]=='i'||S[now]=='?')){ return 0; } if(S[now]=='?')questioncnt--; if(depth==2){ return power26(questioncnt); } ll res = 0; for(auto p: G[now]){ if(seen[p])continue; seen[p]=true; res += BFS(p,depth+1,questioncnt,G,S,seen); res%=MOD; } return res; } int main() { int N, M; string S; cin >> N >> M >> S; vector> G(N,vector(0)); int questioncnt = 0; rep(i,N){ if(S[i]=='?')questioncnt++; } rep(i,M){ int Ai, Bi; cin >> Ai >> Bi; Ai--;Bi--; G[Ai].push_back(Bi); G[Bi].push_back(Ai); } ll ans = 0; rep(i,N){ vector seen(N,false); seen[i]=true; ans += BFS(i,0,questioncnt,G,S,seen); ans%=MOD; } cout << ans << endl; return 0; }