Hello VU students here is the solution of CS508-Modern
Programming Languages Assignment
No.3 Spring 2019. Assignment total marks 20.Due date July 31, 2019. Assignment
Solution in Doc file. You Also Like our Facebook Page, Join Facebook Group, follow on Google+
and Subscribe our YouTube Channel. Please Share it with your
Friends. Thank you.
Solution for the
Assignment is presented for your convenience. Download it and make it according
to your requirement and do not copy paste.
Assignment
Idea Solution:
public static void main(String[] args) {
System.out.println("My ID is bcxxxxxxxxx");
System.out.println("Enter Paragraph");
Scanner s = new Scanner(System.in);
String input = s.nextLine();
System.out.println("Enter comma separated
words");
String word = s.nextLine();
String str = "";
int occurance = 0;
for(char c : input.toCharArray()) {
str += c;
if(str.length() == word.length()) {
if(str.equals(word)) {
occurance ++;
}
str = str.substring(1);
}
}
if(occurance > 0)
System.out.println("The word is exist");
else
System.out.println("The word is not exist");
}
}
Post a Comment