Skip to content

Commit 6f36ab1

Browse files
authored
Create countHi.java
1 parent 88d0f0c commit 6f36ab1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

String-2/countHi.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
public int countHi(String str)
2+
{
3+
int c = 0;
4+
for(int i=0;i<str.length()-1;i++)
5+
if(str.charAt(i) == 'h' && str.charAt(i+1) == 'i')
6+
c++;
7+
return c;
8+
}

0 commit comments

Comments
 (0)