import java.util.*;
import java.lang.*;
import java.io.*;

// The main method must be in a class named "Main".
class Main {
    
    public static void main(String[] args) {
        //System.out.println("Hello world!");

        // // Q1. Print all even numbers from 1 to N/

        // Scanner scn = new Scanner(System.in);
        // int N = scn.nextInt();

        // int i = 1;
        // while(i<N){
        //     if(i%2==0){
        //         System.out.println(i);
        //         }
        //     i+=1;
        // }

    //----------------------------------------------------------------------------------------------------------------------
        // Q2. Print number from 5 to 1.
       
// -- > Method 1 :  
    
        // Scanner scn = new Scanner(System.in);
        // int N = scn.nextInt();
        // int i=5;
        // while(i>=1){
        //     System.out.println(i);
        //     i--;
        // }

// --> Method 2 : 

        // Scanner scn = new Scanner(System.in);
        // int N = scn.nextInt();
        // int i=1;
        // while(N>=1){
        //     System.out.println(N);
        //     N--;
        // }


    //----------------------------------------------------------------------------------------------------------------------
    // Q3. Given a number N, print the same in reverse order.

        Scanner scn = new Scanner(System.in);
        long N = scn.nextLong();
        
        while(N>0){
            long reverse =(N%10);
            System.out.print(reverse+ " ");
            N=N/10;
        }

    //------------------------------------ASSIGNMENTS FOR THE DAY ----------------------------------------------------------------------------------

        // Q1. Problem Description: From top to down
        // Write a program that takes a positive integer N as input from the user and prints all natural numbers from 1 to N, 
        // with each number followed by a space (including the last number).
        
        // Problem Constraints: 1 <= N <= 1000000
        
        // Input Format: A single line representing N
        // Output Format: N space separated integers from 1 to N, 
        // with each number followed by a space, including the last number.
        
        //     Scanner scn = new Scanner(System.in);
        //     int N = scn.nextInt();
        
        //     int i = 1;
        //     if(N>1&&N<=1000000){
        //         while(i<=N){
        //         System.out.println(i);
        //         i++;
        //     }
        // }
        

    //----------------------------------------------------------------------------------------------------------------------
        // Q2. Problem Description: From down to top Write a program to print all Natural numbers from N to 1,
        // where you have to take N as input from user
        
        // Problem Constraints: 1 <= N <= 10000000
        // Input Format: A single line representing N
        // Output Format: N space separated integers from N to 1.

        // Scanner scn = new Scanner(System.in);
        // int N = scn.nextInt();

        // int i=1;
        // while(N>=i){
        //     System.out.println(N + " ");
        //     N--;
        // }

    //----------------------------------------------------------------------------------------------------------------------
        // Q3. Problem Description: Even Game
        // Write a program to print all even numbers from 1 to N where you have to take N as input from the user.
        // Note: Use while-loop OR for-loop, according to session flow.// Problem Constraints: 1 <= N <= 1000000
        // Input Format: A single line representing N
        // Output Format: All even numbers from 1 to N are separated by spaces.
        // Example Input: 10
        // Example Output : 2: 2 4 6 8 10

        // Scanner scn = new Scanner(System.in);
        // int N = scn.nextInt();

        // int i=2;
        // while(i<=N){
        //      if(i%2==0){
        //      System.out.print(i + " ");
        //     }  i++;
        // }

    //----------------------------------------------------------------------------------------------------------------------
        // Q4. Problem Description: Multiples of 4

        // Given an integer input N, print all multiples of 4 less than or equal to N.
        // Problem Constraints: 1 <= N <= 10000
        // Input Format: Single line containing an integer N.
        // Output Format: Space separated integers representing multiples of 4 less than or equal to N.
        
        // Example Input: 22
        // Example Explanation
        // 1 * 4 = 4
        // 2 * 4 = 8
        // 3 * 4 = 12
        // 4 * 4 = 16
        // 5 * 4 = 20

        // Scanner scn = new Scanner(System.in);
        // int N = scn.nextInt();
        
        // int i = 4;
        // while(i<=N){
        //     if(i%4==0){
        //         System.out.print(i + " ");
        //     }i++;
        // }

    //----------------------------------------------------------------------------------------------------------------------
        // Q5. Problem Description: Last Digit Of A Number
        // Given a number N, print the last digit of Number.
        // Problem Constraints: 0 <= N <= 1000000
        // Input Format: Number N in single line
        // Output Format: Print last digit in single line
        // Example Input : 1973
        // Exanoke Output: 3

        // Scanner scn = new Scanner(System.in);
        // int N = scn.nextInt();
        // System.out.print(N%10);

        
    //----------------------------------------------------------------------------------------------------------------------
        // Q6. Problem Description: Print All Digits - From Right To Left
        // Given a number N, Print all digits of number (from right to left) in new line.
        
        // Problem Constraints: -10000 <= N <= 10000
        // Input Format: Take N in single line
        // Output Format: Print Digits of Number in new line
        
        // Example Input: Input 1 : 2001 || Input 2 : -6985
        
        // Example Output
        // Output 1 :
        // 1
        // 0
        // 0
        // 2
        // Output 2 :
        // 5
        // 8
        // 9
        // 6

       //  Scanner scn = new Scanner(System.in);
       //  int N = scn.nextInt();
       //  if(N>=-10000&&N<=10000){
       //      if(N==0){
       //      System.out.println("0");
       //      }
       //      else if(N<0){
       //      N= N*(-1);
       //      }
       //  while(N>0){
       //      System.out.println(N%10);
       //      N=N/10;
       //     }
       // }
        
    //----------------------------------------------------------------------------------------------------------------------

        // Q7. While Loop - 1 MCQ A
        // Choose the correct syntax of the WHILE loop in Java below.
        
        // 1. while(condition) {
        // //statements
        // }
        
        // 2. while(condition);
        // {
        // //statements
        // }
        
        // 3. while {
        // //statements
        // }(condition)
        
        // 4. None
        
    //-->  ANSWER FROM THE SOLUTIONS BELOW:
        
        // 1  -  CORRECT ANSWER.
        // 2
        // 3
        // 4

    //----------------------------------------------------------------------------------------------------------------------

        // Q8. While Loop - 1 MCQ B -- State TRUE or FALSE ?
        // “A WHILE loop in Java executes the statements at least once even if the condition is not satisfied.”
        
        // --> ANSWER FROM THE SOLUTIONS BELOW:
        
        // TRUE   
        // FALSE    - CORRECT ANSWER - Condition must return true value for the while loop for the while block statements to be executed.
                      // Hence, the statement - " A Whi;le loop in Java executes the statements at least once even if the condition is not satisfied."
                      // is "INCORRECT" ||

    //----------------------------------------------------------------------------------------------------------------------

        // Q9. While Loop - 1 MCQ C
        // Every loop in Java has a condition that should be ___ in order to proceed for execution.
        
        // --> ANSWER FROM THE SOLUTIONS BELOW:
            
        // TRUE       - CORRECT ANSWER || the conditions in the loop must be met, for the statements in the loop to be executed ||
        // FALSE

    //----------------------------------------------------------------------------------------------------------------------
        // Q10. While Loop - 1 MCQ D

        // What is the output of the below JAVA program?
        
        // int a=1;
        // while(a<4)
        // {
        // System.out.print(a + " ");
        // a++;
        // }

        // --> ANSWER FROM THE SOLUTIONS BELOW:
        
        // 1 2 3 4
        // 1 2 3       -- CORRECT ANSWER ||
        // 6
        // Compilation Error


    //----------------------------------------------------------------------------------------------------------------------

        // 

    //----------------------------------------------------------------------------------------------------------------------
        
        // Q1. Problem Description: Summation Game

        // Write a program to find sum all Natural numbers from 1 to N where you have to take N as input from user
        // Problem Constraints: 1 <= N <= 1000
        
        // Input Format: A single line representing N
        // Output Format: A single integer showing sum of all Natural numbers from 1 to N

        // Scanner scn = new Scanner(System.in);
        // int N = scn.nextInt();
        // int i = 1;
        // int sum = 0;
        
        // while(i<=N){
        //     sum = sum + i;10
        //     i++;
        // }
        // System.out.println(sum);
        
    //----------------------------------------------------------------------------------------------------------------------
        // Q2. Problem Description: Print Even numbers from N to 0

        // Write a program to print all even numbers from N to 0 where you have to take N as input from the user.
        // Problem Constraints: 1 <= N <= 1000000
        
        // Input Format: A single line representing N.
        // Output Format: All even numbers from N to 0 are separated by spaces.

        // Scanner scn = new Scanner(System.in);
        // int N = scn.nextInt();

        // int i = 0;
        // while(N>=i){
        //     if(N%2==0){
        //         System.out.print(N + " ");
        //     }N--;
        // }
        
    //----------------------------------------------------------------------------------------------------------------------
        // Q3. Problem Description: Odd Game

        // Write a program to print all odd numbers from 1 to N where you have to take N as input from user. Here N is inclusive.
        // Note:Each number should be followed by a space, including the last number.
        
        // Problem Constraints: 1 <= N <= 2000000
        // Input Format: A single line representing N
        // Output Format: All odd numbers from 1 to N, each number followed by a space, including the last number.

        // Scanner scn = new Scanner(System.in);
        // int N = scn.nextInt();

        // int i = 1;
        // if(N>=1&&N<=2000000){
        //     while(i<=N){
        //         if(i%2!=0){
        //             System.out.print(i + " ");
        //             i+=2;
        //         }
        //     }
        // }else if (N==0){
        //      System.out.print("0");
        // }
    
    //----------------------------------------------------------------------------------------------------------------------

        // Q4. Problem Description: Sum of Odds - Easy

        // Take an integer A as input. You have to print the sum of all odd numbers in the range [1, A].
        // Problem Constraints: 1 <= A <= 1000
        
        // Input Format: First and only line contains a single positive integer A.
        // Output Format: Print the required sum in a single line.

        // Scanner scn = new Scanner(System.in);
        // int N = scn.nextInt();

        // int i = 1;
        // int sum = 0;
        // if(N>=1&&N<=1000){
        //     while(i<=N){
        //         if(i%2!=0){
        //             sum = sum + i;
        //         }i++;
        //     }System.out.print(sum);
        // }
    
    //----------------------------------------------------------------------------------------------------------------------
        // Q5. Problem Description: Sum of Evens - easy
        // You are given a positive integer A. You have to print the sum of all even numbers in the range [1, A].
        
        // Problem Constraints: 1 <= A <= 1000
        // Input Format: First and only line contains a single positive integer A.
        // Output Format: Print the required sum in a single line.
        
        // Example Input 1 : 1 || Output = 0 
        // Example Input 2 : 4 || Output = 6

        // Scanner scn = new Scanner(System.in);
        // int N = scn.nextInt();

        // int i = 2; 
        // int sum= 0;
        // if(N>=1&&N<=1000){
        //     while(i<=N){
        //         if(i%2==0){
        //             sum = sum+i;
        //         }i+=2;
        //     }System.out.println(sum);
        // }

    //----------------------------------------------------------------------------------------------------------------------

        // Q6. Problem Description: Multiplication Table!

        // Take a number A as input, print its multiplication table having the first 10 multiples.
        // Problem Constraints: 1 <= A <= 1000
        // Input Format: First line contains a single integer A.
        // Output Format: Print 10 lines, ith line containing ith multiple.
        // Example Input: Input 1: 2 || Input 2: 3 

        // Scanner scn = new Scanner(System.in);
        // int N = scn.nextInt();
    
        // int i = 1;
        // int m = 1;
        // if(N>=1&&N<=1000){
        // while(i<=10){
        // System.out.println(N + " * " + m + " = " + N*m);
        // i++;
        // m++;
        // }
        // }

    //----------------------------------------------------------------------------------------------------------------------

        // Q7. While Loop - 1 MCQ F
        // What is the output of the below program?
        
        // int num = 2;
        // int i=0;
        // while(i<5)
        // {
        // System.out.print(num * i + " ");
        // i++;
        // }

        //--> ANSWER FROM THE BELOW SOLUTIONS.
        
        // A) 0 2 4 6 8 -  CORRECT ANSWER ||
        // B) 2 4 6 8 10
        // C) 0 1 2 3 4
        // D) 1 2 3 4 5
        
    //----------------------------------------------------------------------------------------------------------------------

        // Q8. While Loop - 1 MCQ G
        // What will be the output of the JAVA program?
        
        // int i = 0;
        // while(i < 4){
        // if(i % 2 == 0){
        // System.out.print(“YES ”);
        // }else{
        // System.out.print(“NO “);
        // }
        // i += 2;
        // }
        
        // --> ANSWER FROM THE BELOW SOLUTIONS ||
        
        // 1) YES YES  - CORRECT ANSWER ||
        // 2) YES NO
        // 3) NO YES -  
        // 4) NO NO

    //----------------------------------------------------------------------------------------------------------------------

        // Q9. While Loop - 1 MCQ I
        // What will be the output of the following JAVA snippet?
        
        // int a = 5;
        // int b = 15;
        // while(b != a){
        // System.out.print("TRUE ");
        // b -= 10;
        // }
        // System.out.print("FALSE ");
        
        // --> ANSWER FROM THE BELOW SOLUTIONS:
        
        // 1. TRUE FALSE   -   CORRECT ANSWER ||
        // 2. TRUE TRUE FALSE
        // 3. FALSE
        // 4. Compilation Error


    //----------------------------------------------------------------------------------------------------------------------

        // Q10. Solved While Loop - 1 MCQ E
        
        
        // What is the output of the below JAVA program?
        // int a=4;
        // while(a>0)
        // {
        // a--;
        // System.out.print(a + " ");
        // a--;
        // }

    //--------------------------------------------------------
        // A. 4 3 2 1
        // B. 3 1     - CORRECT ANSWER ||
        // C. 4 2
        // D. 3 2 1
    //----------------------------------------------------------------------------------------------------------------------

    // Q11. Problem Description Steps Of Frog
    // A frog is currently at position X, jump size (i.e. the distance covered in single jump by frog) is Y.
    // Print next 5 position when frog take 5 continuous jumps.
    
    // Problem Constraints: -100000 <= X <= 1 || 0 < Y <= 1000 ||
    
    // Input Format
    // In first line, take Integer X from user. In second line, take Integer Y from user.
    // Output Format: Print 5 space separated position which is jumped by frog.

    //     Scanner scn = new Scanner(System.in);
    //     int x = scn.nextInt();
    //     int y = scn.nextInt();
    
    //     int i=1;
    //     int curr= x;
    //     int jump= y;
    //     if(x>=1)
    //     while(i<=5){
    //         System.out.print(curr+jump + " ");
    //         i++;
    //         jump+=y;
    //         }
    //     else if(x<=0){
    //         while(i<=5){
    //         System.out.print(curr+jump + " ");
    //         i++;
    //         jump+=y;
    //         }
    //     }
            
        }
    }

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: