VMSS Pre-Windsor P1 - Java

View as PDF

Submit solution

Points: 3
Time limit: 2.0s
Memory limit: 64M

Authors:
Problem type

Syed likes Java. In fact, he likes Java so much, that he can't help but try to insert it into everything he writes. Syed has typed out a string of lowercase characters for his essay - since he is such a grandmaster at writing English essays, he does not need ridiculous things like correct grammar, spaces, capitalization, or any form of punctuation to communicate his incredibly deep ideas. Find the number of characters before the first letter of the first occurrence of the substring java.

Input Specification

A single string of lowercase letters that is up to 1\,000 characters long on a single line.

Output Specification

The number of characters before the first letter of the first occurrence of the substring java. If the substring java does not occur, output the length of the string instead.

Sample Input 1

ilikejava

Sample Output 1

5

Sample Input 2

javaisbestlang

Sample Output 2

0

Sample Input 3

onehundredinenglishbtw

Sample Output 3

22

Comments


  • 8
    Tommy_Shan  commented on Sept. 23, 2021, 10:35 p.m.

    Although Syed like Java, but this question is easier to write in Python :)