Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package project;
- import java.util.Scanner;
- import java.lang.Math;
- public class Main {
- public static void main(String[] args) {
- Scanner scan = new Scanner (System.in);
- System.out.println("Enter message board post:");
- String post = scan.nextLine();
- int divider = (post.indexOf('-'));
- String username = (post.substring(0, divider-1));
- String omessage = (post.substring(divider));
- String message = ((omessage.toLowerCase() + " ")) ;
- int flag= 1;
- int curse1= 0;
- int curse2= 0;
- int curse3= 0;
- for (int i= 0; i < (message.length()-1); i++) {
- if (message.charAt(i) == '^') {
- if (message.charAt(i-1) == ' ') {
- if (message.charAt(i+1) == '^') {
- if(message.charAt(i+2) == ' ') {
- curse1++; } } } }
- if (message.charAt(i) == 'e') {
- if (message.charAt(i-1) == 'q') {
- if (message.charAt(i+1) == 'y') {
- if (message.charAt(i-2) == ' ') {
- if ((message.charAt(i+2)) == ' ') {
- curse2++; } } } } }
- if (message.charAt(i) == '$') {
- if (message.charAt(i-1) == ' ') {
- if (message.charAt(i+1) == ' ') {
- curse3++; } } }
- }
- if (curse1>0 || curse2>0 || curse3>0) {
- System.out.println("Results:" + '\n');
- System.out.println("BAD" + '\n' + username);
- System.out.println("^^: " + curse1);
- System.out.println("qey: " + curse2);
- System.out.println("$: " + curse3);
- }
- else {
- System.out.println("Results: \n\nCLEAN");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement