How to check if string can be used to create a palindrome

This is a code to check if we can make a palindrome using all letters of string

Input: str is a given string.

NOTE: assumption every character have to be use present in the string, and only once.

Logic: only one alphabet can have odd occurence,rest should have even occurence.




public static void main(String asd[]){


int count= 0;

int odd_occurence = 0;

//str is given can initialize str with ant input you want.

String str =  “apapqqqqjjk”;

Boolean output = true;

for(int i =0;i<str.length();i++){

                for(int j=0;j 1)


                                output = false;






                system.out.println(“palindrome can be created”);


                system.out.println(“palindrome cannot be created”);