Please read the new rule regarding the restriction on the use of AI tools. ×

Bahaa_Elden's blog

By Bahaa_Elden, history, 9 years ago, In English

package capitialize;

import java.util.Scanner;

public class Capitialize {

public static void main(String[] args) {

Scanner in= new Scanner(System.in); char[] st =new char[50]; int i,w,res=0; w=in.nextInt(); for(i=0;i<w;i++){ st[i]=in.next().charAt(0); if(i>0){if(st[i]==st[i-1]){res++;}}
} System.out.println(res); } }

Full text and comments »

  • Vote: I like it
  • -5
  • Vote: I do not like it