#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define vint vector<int>
#define vll vector<long long int>
#define endl cout << '\n'
#define fre(i, l, n) for (int i = l; i < n; ++i)
#define fr(i, l, n) for (int i = l; i <= n; i++)
#define rfre(i, n, l) for (int i = n - 1; i >= l; i--)
#define rfr(i, n, l) for (int i = n; i >= l; --i)
#define tab '\t'
#define debug cout << '*';
#define s(a) cin >> a;
#define p(a) cout << a;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int, int> pii;
typedef pair<long long int, long long int> pll;
typedef pair<int, pair<int, int>> tii;
typedef vector<int> vec;
typedef vector<long long> vecll;
typedef vector<pair<int, int>> vec_pii;
typedef vector<pair<long long int, long long int>> vec_pll;
typedef vector<vector<int>> ugraph;
typedef vector<vector<pair<int, int>>> wgraph;
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define mod 1000000007
#define Pi 3.14159265358979
#define gcd(a, b) __gcd(a, b)
#define sf(n) scanf("%lld", &(n))
#define pf(n) printf("%lld\n", (n))
#define min3(a, b, c) (min((c), min((a), (b))))
#define max3(a, b, c) (max((a), max((b), (c))))
#define w(t) while (t--)
#define flt(a) cout << fixed << setprecision(a)
bool vow(char ch)
{
if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u')
{
return true;
}
return false;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
ll t;
s(t);
w(t)
{
string str;
cin >> str;
int hash[26] = {0};
for (ll i = 0; i < str.length(); i++)
{
if (!vow(str[i]))
{
hash[str[i] - 'a']++;
}
}
ll cnt = 0;
for (ll i = 0; i < 26; i++)
{
if (hash[i])
{
cnt++;
}
}
if (cnt % 2)
{
cout << "HE!\n";
}
else
{
cout << "SHE!\n";
}
}
return 0;
}
using namespace std;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define vint vector<int>
#define vll vector<long long int>
#define endl cout << '\n'
#define fre(i, l, n) for (int i = l; i < n; ++i)
#define fr(i, l, n) for (int i = l; i <= n; i++)
#define rfre(i, n, l) for (int i = n - 1; i >= l; i--)
#define rfr(i, n, l) for (int i = n; i >= l; --i)
#define tab '\t'
#define debug cout << '*';
#define s(a) cin >> a;
#define p(a) cout << a;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int, int> pii;
typedef pair<long long int, long long int> pll;
typedef pair<int, pair<int, int>> tii;
typedef vector<int> vec;
typedef vector<long long> vecll;
typedef vector<pair<int, int>> vec_pii;
typedef vector<pair<long long int, long long int>> vec_pll;
typedef vector<vector<int>> ugraph;
typedef vector<vector<pair<int, int>>> wgraph;
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define mod 1000000007
#define Pi 3.14159265358979
#define gcd(a, b) __gcd(a, b)
#define sf(n) scanf("%lld", &(n))
#define pf(n) printf("%lld\n", (n))
#define min3(a, b, c) (min((c), min((a), (b))))
#define max3(a, b, c) (max((a), max((b), (c))))
#define w(t) while (t--)
#define flt(a) cout << fixed << setprecision(a)
bool vow(char ch)
{
if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u')
{
return true;
}
return false;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
ll t;
s(t);
w(t)
{
string str;
cin >> str;
int hash[26] = {0};
for (ll i = 0; i < str.length(); i++)
{
if (!vow(str[i]))
{
hash[str[i] - 'a']++;
}
}
ll cnt = 0;
for (ll i = 0; i < 26; i++)
{
if (hash[i])
{
cnt++;
}
}
if (cnt % 2)
{
cout << "HE!\n";
}
else
{
cout << "SHE!\n";
}
}
return 0;
}
not getting full 100%. Test cast 1,2,3,4 are failing
ReplyDeletethis is evaluating only 33%
ReplyDeleteH5 PROGRAM 'C++ LANGUAGE'
ReplyDelete#include
#include
using namespace std;
int main() {
int n, t, sol;
cin >> t;
string s;
while (t--) {
int count[10000];
cin >> s;
sol = 0;
memset(count, 0, sizeof(count));
int n = (int) s.size();
for (int i = 0; i < n; i++) count[s[i] - 'a']++;
for (int i = 0; i < 26; i++) {
sol += (count[i] % 2);
}
sol--;
sol = max(sol, 0);
cout << sol << endl;
}
return 0;
}
ReplyDeleteiostream and bits/stdc++.h
ReplyDelete