Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class JavaApplication8 {
- public static int str(String gdzie, String co)
- {
- int a = co.length();
- int b =0;
- boolean c = false;
- for (int i=0;i<gdzie.length()-co.length();i++)
- {
- if (c = false)
- {
- a = co.length();
- }
- int j =0;
- for (j=0;j<co.length();j++)
- {
- if (gdzie.charAt(i+j) == co.charAt(j))
- {
- c = true;
- a= a-1;
- System.out.println(a);
- }
- else
- {
- c = false;
- }
- if (a == 0)
- {
- b+=1;
- a = co.length();
- }
- }
- }
- System.out.println(b);
- return b;
- }
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- // TODO code application logic here
- str("Ala ma kota ma kota ma mama","ma");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment