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.
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.
123 abcd
abcd 123
64 Apples
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 also: age1
Copyright © 2020-2021 Rudy Matela
This text is available under the CC BY-SA 4.0 license.
Originally available on cscx.org/swap1