첫 글자와 마지막 글자를 출력하라.
Bash
bash
read t
for ((i=0; i<t; i++)); do
read str
echo ${str::1}${str: -1}
done
1
2
3
4
5
2
3
4
5
Node.js
javascript
const [t, ...arr] = require("fs").readFileSync(0).toString().trim().split("\n");
for (let str of arr) {
console.log( str[0] + str[str.length-1] );
}
1
2
3
4
2
3
4
Python3
python
t = int(input())
for i in range(t):
a = input()
print(a[0] + a[-1])
1
2
3
4
2
3
4
Ruby
ruby
t = gets.chomp.to_i
for i in 0...t
str = gets.chomp
puts str[0] + str[-1]
end
1
2
3
4
5
2
3
4
5
Comments
Not supported comment edit and upvote
You can do it on this page if you want.