EQSTR - Biến đổi chuỗi

Tác giả: happyboy99x

Ngôn ngữ: C++

#include<string>
#include<cstdio>
#include<cstring>
using namespace std;

inline void f(char &s, char t) {
	if(s > t) swap(s, t);
	s = t - s < 26 - t + s ? s : 'a';
}

void getEq(char * s, const char * t) {
	const int n = strlen(s);
	for(int i = 0; i < n; ++i) f(s[i], t[i]);
	printf("%s\n", s);
}

char s[51], t[51];

int main() {
	while(scanf("%*s%s%s",s,t) != EOF) getEq(s, t);
	return 0;
}

Download