Skip to content

Instantly share code, notes, and snippets.

@modos
Created June 18, 2021 04:48
Show Gist options
  • Save modos/f290966b3ce9a884e5a350259b2c02bf to your computer and use it in GitHub Desktop.
Save modos/f290966b3ce9a884e5a350259b2c02bf to your computer and use it in GitHub Desktop.
رژیم سخت
import java.util.Scanner;
class Main {
static Scanner sc;
public static void main(String[]args){
sc = new Scanner(System.in);
String string = sc.nextLine();
int r = 0;
int g = 0;
int y = 0;
for (char ch : string.toCharArray()) {
if(String.valueOf(ch).equals("R") || String.valueOf(ch).equals("r"))
r++;
else if(String.valueOf(ch).equals("G") || String.valueOf(ch).equals("g"))
g++;
else if(String.valueOf(ch).equals("Y") || String.valueOf(ch).equals("y"))
y++;
}
if( (y == string.length() || r == string.length()) || (r >= 3) || (r >= 2 && y >= 2) || (y==4 && r==1) ) {
System.out.println("nakhor lite");
} else {
System.out.println("rahat baash");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment