0

can any one help me with this code error is in line 9 and 19 (program to find and count repeated alphabet)

public class countRepate { public static void Repeat(String sent,int n,int count){ if(n>sent.length()){ return; } char curr=sent.charAt(n); for(int i=0;i<=sent.length();i++){ if(n!=i){ if(curr == sent.charAt(i)){ count+=1; } } } System.out.println(curr+" : "+count); Repeat(sent, n+1,0); } public static void main(String args[]){ String Sen="ssddetfyghghi"; Repeat(Sen,0,0); } }

17th May 2022, 5:16 AM
Sahil Jadhav
1 Answer
+ 2
Sahil Jadhav 1 - if(n > sent.length() - 1) 2 - for(int i = 0; i < sent.length(); i++)
17th May 2022, 5:31 AM
AÍąJ
AÍąJ - avatar