Advertisement
Spocoman

05. Character Sequence

Aug 26th, 2024 (edited)
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.64 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class CharacterSequence {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         String text = scanner.nextLine();
  7.  
  8.         for (int i = 0; i < text.length(); i++) {
  9.             System.out.println(text.charAt(i));
  10.         }
  11.     }
  12. }
  13.  
  14. ИЛИ:
  15.  
  16. import java.util.Scanner;
  17.  
  18. public class CharacterSequence {
  19.     public static void main(String[] args) {
  20.         Scanner scanner = new Scanner(System.in);
  21.         String text = scanner.nextLine();
  22.  
  23.         for (char character: text.toCharArray()) {
  24.             System.out.println(character);
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement