# L-10.5 MCS 260 Wed 9 Jul 2014 : q01.py
"""
Consider the flowchart, that takes on input the word w
            +----------------+
            |   n = len(w)   |
            +----------------+
     +------------->|
     |              |
     |              %
     |             % %
     |            %   %    False    +---------+
     |           % n>0?%  --------> |  stop   |
     |            %   %             +---------+
     |             % %
     |              %
     |              |  True
     |              |
     |      +-------+--------+
     |      |    n = n - 1   |
     |      |    print w[n]  |
     |      +----------------+
     |              |
     |              |
     +--------------+

(a) Write Python code based using the same control logic
    as shown in the flowchart.
(b) Write Python code that uses a for loop.
"""
WORD = raw_input('give a word : ')
N = len(WORD)
while N>0:
    N = N - 1
    print WORD[N]
N = len(WORD)
for k in range(N):
    print WORD[N-k-1]
