https://github.com/thebrianbug/reversewords
Google CodeJam Solution
https://github.com/thebrianbug/reversewords
Last synced: 8 months ago
JSON representation
Google CodeJam Solution
- Host: GitHub
- URL: https://github.com/thebrianbug/reversewords
- Owner: thebrianbug
- Created: 2016-01-21T18:22:41.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-01-23T02:38:43.000Z (over 10 years ago)
- Last Synced: 2025-07-21T23:48:30.518Z (11 months ago)
- Language: Python
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.txt
Awesome Lists containing this project
README
Correct!
Problem
Given a list of space separated words, reverse the order of the words. Each line of text contains L letters and W words. A line will only consist of letters and space characters. There will be exactly one space character between each pair of consecutive words.
Input
The first line of input gives the number of cases, N.
N test cases follow. For each test case there will a line of letters and space characters indicating a list of space separated words. Spaces will not appear at the start or end of a line.
Output
For each test case, output one line containing "Case #x: " followed by the list of words in reverse order.
Limits
Small dataset
N = 5
1 ≤ L ≤ 25
Large dataset
N = 100
1 ≤ L ≤ 1000
Sample
Input
3
this is a test
foobar
all your base
Output
Case #1: test a is this
Case #2: foobar
Case #3: base your all