index | submit | rank | book

swap1 – Printing in swapped order (easy version)

Write a program that reads an integer and a string and prints them in swapped order. After reading number n and string s, it prints string s followed by number n.

Swapping 123 and abcd

Input and Output

Input will consist of a single line containing a natural number n and a string s.

|s| ≤ 30, i.e.: the string s is no more than 30 characters

0 ≤ n ≤ 1000

Your program should produce a single line containing the string s followed by the number n separated by a single space. This line should be terminated by a line break.

Example Input 1

123 abcd

Example Output 1

abcd 123

Example Input 2

64 Apples

Example Output 2

Apples 64



Input is given on a single line as shown above, e.g.: 64 Apples, that is “64[space]Apples[enter]”. If you are having trouble with this exercise, check this explanation on how to read two values on a single line in Python, C and Haskell.

This exercise is easier if you solve hello, hi1 and repeat1 first.

try first: repeat1 hi1

try also: age1

try next: triple1 inc1

index | submit | rank | book

Copyright © 2020-2023 Rudy Matela
All rights reserved