列表

详情


NC25048. [USACO 2007 Jan L]Names, Cow

描述

Farmer John is about to submit an annual report about his cows. He's supposed to list the cows by name, but the sheet he's filling out asks for a last-name-first format, and all his notes on the cows list their names in the other order. Being somewhat lazy, FJ would rather not have to switch the names around every time. Write a program to switch a cow's names for him.
None of FJ's cows has a first or last name longer than 30 characters.

输入描述

Line 1: Two space-separated words, the first and last names of a cow

输出描述

Line 1: The last name, followed by a comma and a space, then the first name

示例1

输入:

Bessy Bovine

输出:

Bovine, Bessy

原站题解

上次编辑到这里,代码来自缓存 点击恢复默认模板

Python3 解法, 执行用时: 41ms, 内存消耗: 4496K, 提交时间: 2023-08-15 07:42:09

f, l = input().split()
print(f'{l}, {f}')

上一题