#include <iostream> #include <string>

using namespace std;

inline pair<char, char> is_first_last_word(const string word) { return { word.front(), word.back() }; }

int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false);

int T;
cin >> T;

for (int test_case = 0; test_case < T; ++test_case) {
	string word;
	cin >> word;

	auto [ first, last ] = is_first_last_word(word);
	cout << first << last << "\\\\n";
}

return 0;

}

  1. string.front() >> 맨앞글자 반환char형
  2. string.back() >> 맨 뒷글자 반환 char형