Monday, March 14, 2016

UVa 11713 - Abstract Names

// UVa 11713 - Abstract Names
#include <string>
#include <iostream>
using namespace std;

bool vowel(char c) {
	return (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u');

}

bool same(const string & a, const string & b) {
	if (a.length() != b.length())
		return false;
	for (int i = 0; i < a.length(); i++)
		if (a[i] != b[i] && (!vowel(a[i]) || !vowel(b[i])))
			return false;
	return true;
}

int main() {
	int n;
	cin >> n;
	for (; n > 0; n--) {
		string a, b;
		cin >> a >> b;
		cout << (same(a, b) ? "Yes" : "No") << endl;
	}
	return 0;
}

No comments:

Post a Comment