문자열 (9086)

Created:

Baekjoon No.9086
첫 글자와 마지막 글자를 출력하라.

Bash

Bash
1
2
3
4
5
read t
for ((i=0; i<t; i++)); do
	read str
	echo ${str::1}${str: -1}
done

Node.js

JavaScript
1
2
3
4
const [t, ...arr] = require("fs").readFileSync(0).toString().trim().split("\n");
for (let str of arr) {
	console.log( str[0] + str[str.length-1] );
}

Python3

Python
1
2
3
4
t = int(input())
for i in range(t):
    a = input()
    print(a[0] + a[-1])

Ruby

Ruby
1
2
3
4
5
t = gets.chomp.to_i
for i in 0...t
  str = gets.chomp
  puts str[0] + str[-1]
end