//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> 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; vector<ll> P26={1}; ll power26(int x){ while(P26.size()<=x){ P26.push_back(P26[P26.size()-1]*26%MOD); } return P26[x]; } ll DFS(ll now, int depth, int questioncnt,vector<vector<int>> G,string S, set<int> seen){ seen.insert(now); 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.count(p))continue; res += DFS(p,depth+1,questioncnt,G,S,seen); res%=MOD; } return res; } int main() { int N, M; string S; cin >> N >> M >> S; vector<vector<int>> G(N,vector<int>(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){ set<int> seen; seen.insert(i); ans += DFS(i,0,questioncnt,G,S,seen); ans%=MOD; } cout << ans << endl; return 0; }