Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Bobby {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- while (scanner.hasNextLine()) {
- String sentence = scanner.nextLine();
- boolean isScold = false;
- char[] sentenceArr = sentence.toCharArray();
- for (int i = 0; i < sentenceArr.length; i++) {
- if (!Character.isLetter(sentenceArr[i])) {
- continue;
- }
- if (Character.isUpperCase(sentenceArr[i])) {
- isScold = true;
- }
- }
- if (sentence.endsWith("?") && !isScold) {
- System.out.println("Добре!");
- } else if (sentence.endsWith("?") && isScold) {
- System.out.println("Спокоооо, знам к'во правя!");
- } else if (sentence.endsWith("!") && isScold) {
- System.out.println("Споко бе мен!");
- } else if ("".equals(sentence)) {
- System.out.println("Хубаво деее");
- } else
- System.out.println("Ахъ");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement