java learning




//print format
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        // put your code here
        Scanner scanner = new Scanner(System.in);

        String firstName = scanner.next();
        scanner.next();
        scanner.next();
        scanner.next();
        String cuisine = scanner.next();

        System.out.println(String.format(
                "The form for %s is completed. We will contact you if we need a chef that cooks %s dishes.",
                firstName, cuisine));
    }
}


//scanner read, stack, system in out
import java.util.*;

class Main {
    public static void main(String[] args) {
        Stack<String> strings = new Stack<>();
        Scanner scanner = new Scanner(System.in);

        while (scanner.hasNext()) {
            strings.push(scanner.next());
        }

        while (!strings.empty()) {
            System.out.println(strings.pop());
        }
    }














上一篇:Redis之Strings


下一篇:[CF149E] Martian Strings - 后缀自动机