WC '15 Contest 2 J1 - A New Hope

View as PDF

Submit solution


Points: 3
Time limit: 1.0s
C# 3.0s
Memory limit: 16M
C# 32M

Author:
Problem type
Woburn Challenge 2015-16 Round 2 - Junior Division

"It is a period of civil war. Rebel programs, striking from a hidden computer, have won their first victory against the evil System Tests."

You might be aware that the events of the Star Wars saga took place a long time ago, in a galaxy that was rather far away. But just how far away was it? We can try to describe it by repeating the word far a certain number of times in the following sentence format:

A long time ago in a galaxy far, far away...

In the above example, the word far is repeated twice. However, we'd instead like to repeat it exactly N (1 \le N \le 5) times without changing the rest of the sentence at all. There should be a comma right after each occurrence except for the last one.

Given N, can you produce the correct sentence?

Input Specification

The input consists of a single integer N.

Output Specification

Output on a single line the appropriate sentence with far repeated N times. It must match the correct answer exactly!

Sample Input 1

1

Sample Output 1

A long time ago in a galaxy far away...

Sample Input 2

4

Sample Output 2

A long time ago in a galaxy far, far, far, far away...

Comments


  • 2
    pavansai  commented on March 22, 2024, 5:44 p.m.

    I dont understand why my code doest work as i am getting expected output can some one help

    a=int(input()) b= int(1) a= a-b if(a==0): print('A long time ago in a galaxy far away')

    else: print('A long time ago in a galaxy ' +'far,'*a+'far away')


    • 0
      htoshiro  commented on March 24, 2024, 12:28 a.m.

      where are the ending "..." also you dont need the if statement