Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
checkingWord
//'main' method must be in a class 'Rextester'. //openjdk version '11.0.5' import java.util.*; import java.lang.*; class Rextester { public static void main(String args[]) { String str = "Powerful people play professionally"; System.out.println(start_with_p(str)+"\n"); str = "punch purple pears"; System.out.println(start_with_p(str)+"\n"); str = "pirates pillage and plunder"; System.out.println(start_with_p(str)+"\n"); } public static boolean start_with_p(String str){ boolean status = false; String[] words = str.split(" "); //case 2 if(words.length <= 3){ return false; } for(int i=0; i < words.length; i++){ //case 1 if( words[i].charAt(0) == 'P' || words[i].charAt(0) == 'p' ){ status = true; } //case 3 else { return false; } } return status; } }
run
|
edit
|
history
|
help
0
kochergina_3
To check whether a given number is smith number or not
Item battle rolyal
KatyaPetrova
Ab
Inheritance
191fa07050(1(D))
reverse integer
Combination Sum (Leetcode)
js