String Question 9
Question 19. Write a Program to delete alternate characters in string.
Program
class Solution { static String delAlternate(String S) { String str=""; int len=S.length(); for(int i=0;i<len;i++) { if(i%2==0) { str=str+S.charAt(i); } } return str; } } |