├── Anagram.java ├── Ascii.java ├── Fre.java ├── Length.java ├── Main.java ├── Main1.jav ├── Main1.java ├── ModifiedString.java ├── Nonrepeated.java ├── RepWord.java ├── Repeatedword.java ├── Reverse.java ├── Split.java ├── SumofNumber.java ├── SumofNumber1.java ├── Toggle.java ├── Vowels.java ├── VowelsRemove.java └── permute.py /Anagram.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class Anagram { 4 | public static void main(String args[]) { 5 | Scanner sc = new Scanner(System.in); 6 | System.out.println("Enter the first String :"); 7 | String a = sc.nextLine(); 8 | System.out.println("Enter the second String :"); 9 | String b = sc.nextLine(); 10 | 11 | // Remove spaces and convert to lowercase to ensure case-insensitivity 12 | a = a.replaceAll("\\s", "").toLowerCase(); 13 | b = b.replaceAll("\\s", "").toLowerCase(); 14 | 15 | // Check if lengths are equal 16 | if (a.length() != b.length()) { 17 | System.out.println("Not Anagram"); 18 | } else { 19 | // Convert strings to character arrays and sort them 20 | char[] a1 = a.toCharArray(); 21 | char[] b1 = b.toCharArray(); 22 | 23 | Arrays.sort(a1); 24 | Arrays.sort(b1); 25 | 26 | // Compare sorted arrays 27 | if (Arrays.equals(a1, b1)) { 28 | System.out.println("Anagram"); 29 | } else { 30 | System.out.println("Not Anagram"); 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Ascii.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class Ascii { 4 | public static void main(String args[]) { 5 | Scanner sc = new Scanner(System.in); 6 | System.out.println("Enter the character :"); 7 | char word = sc.next().charAt(0); 8 | int ascii = word; 9 | System.out.println("ASCII value of '" + word + "' is: " + ascii); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Fre.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class Fre { 4 | public static void main(String args[]) { 5 | Scanner sc = new Scanner(System.in); 6 | System.out.println("Enter the String :"); 7 | String word = sc.nextLine(); 8 | int []freq=new int[word.length()]; 9 | int i,j; 10 | char string[]=word.toCharArray(); 11 | for( i=0;i=91) || (ch<98 && ch>124)) 11 | { 12 | System.out.println("Alphabets"); 13 | } 14 | else 15 | { 16 | System.out.println("Not a Alphabets"); 17 | } 18 | } 19 | 20 | } 21 | } 22 | 23 | 24 | -------------------------------------------------------------------------------- /Main1.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | public class Main1 { 3 | public static void main(String args[]) { 4 | Scanner sc=new Scanner(System.in); 5 | System.out.println("Enter the string :"); 6 | String word=sc.nextLine(); 7 | for(int i=0;i='a' && ch<='z') || (ch>='A' && ch<='Z')) 11 | { 12 | System.out.println("Alphabets"); 13 | } 14 | else 15 | { 16 | System.out.println("Not a Alphabets"); 17 | } 18 | } 19 | 20 | } 21 | } 22 | 23 | 24 | -------------------------------------------------------------------------------- /ModifiedString.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class ModifiedString{ 4 | public static void main(String args[]) { 5 | Scanner sc = new Scanner(System.in); 6 | System.out.println("Enter the String :"); 7 | String word = sc.nextLine(); 8 | System.out.println("Enter the Repeat String :"); 9 | String toreplace = sc.nextLine(); 10 | System.out.println("Enter the new String :"); 11 | String newstring = sc.nextLine(); 12 | if(!word.contains(toreplace)) 13 | { 14 | System.out.println(word); 15 | } 16 | String modified=word.replaceAll(toreplace,newstring); 17 | 18 | System.out.println(modified); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Nonrepeated.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class Nonrepeated { 4 | public static void main(String args[]) { 5 | Scanner sc = new Scanner(System.in); 6 | System.out.println("Enter the String :"); 7 | String word = sc.nextLine(); 8 | 9 | // Create a HashMap to store the frequency of each character 10 | Map charCount = new HashMap<>(); 11 | 12 | // Count the frequency of each character in the string 13 | for (int i = 0; i < word.length(); i++) { 14 | charCount.put(word.charAt(i), charCount.getOrDefault(word.charAt(i), 0) + 1); 15 | } 16 | 17 | // Print the characters that appear only once 18 | System.out.println("Non-repeated characters:"); 19 | for (int i = 0; i < word.length(); i++) { 20 | if (charCount.get(word.charAt(i)) == 1) { 21 | System.out.print(word.charAt(i) + " "); 22 | } 23 | } 24 | System.out.println(); // Add a new line after output 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /RepWord.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class SumofNumber1 { 4 | public static void main(String args[]) { 5 | Scanner sc = new Scanner(System.in); 6 | System.out.println("Enter the String :"); 7 | String word = sc.nextLine(); 8 | System.out.println("Enter the replace String :"); 9 | String repword= sc.nextLine(); 10 | String newword=""; 11 | String stringarr[]=word.split(" "); 12 | for(char words:stringarr) 13 | { 14 | if(!words.equals(repword)) 15 | { 16 | newword+=words+" "; 17 | } 18 | } 19 | System.out.println(newword); 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Repeatedword.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class Repeatedword { 4 | public static void main(String args[]) { 5 | Scanner sc = new Scanner(System.in); 6 | System.out.println("Enter the String :"); 7 | String word = sc.nextLine(); 8 | System.out.println("Enter the replace String :"); 9 | String repword= sc.nextLine(); 10 | String newword=""; 11 | String stringarr[]=word.split(" "); 12 | for(String words:stringarr) 13 | { 14 | if(!words.equals(repword)) 15 | { 16 | newword+=words+" "; 17 | } 18 | } 19 | System.out.println(newword); 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Reverse.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class Reverse { 4 | public static void main(String args[]) { 5 | Scanner sc = new Scanner(System.in); 6 | System.out.println("Enter the String :"); 7 | String word = sc.nextLine(); 8 | StringBuilder res=new StringBuilder(); 9 | 10 | for(int i=word.length()-1;i>=0;i--) 11 | { 12 | System.out.println(word.charAt(i)); 13 | 14 | } 15 | 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Split.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class Split{ 4 | public static void main(String args[]) { 5 | Scanner sc = new Scanner(System.in); 6 | System.out.println("Enter the String :"); 7 | String word = sc.nextLine(); 8 | char[] c=word.toCharArray(); 9 | StringBuilder sb=new StringBuilder(); 10 | for(int i=0;i='0' && word.charAt(i)<='9' ) 12 | { 13 | sum+=word.charAt(i)-'0'; 14 | 15 | } 16 | 17 | } 18 | System.out.println(sum); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Toggle.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class Toggle { 4 | public static void main(String args[]) { 5 | Scanner sc = new Scanner(System.in); 6 | System.out.println("Enter the String :"); 7 | String word = sc.nextLine(); 8 | String res = ""; 9 | 10 | for (int i = 0; i < word.length(); i++) { 11 | 12 | if (Character.isUpperCase(word.charAt(i))) { 13 | 14 | res = res + Character.toLowerCase(word.charAt(i)); 15 | } else { 16 | 17 | res = res + Character.toUpperCase(word.charAt(i)); 18 | } 19 | } 20 | 21 | System.out.println("Toggled String: " + res); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Vowels.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class Vowels { 4 | public static void main(String args[]) { 5 | Scanner sc = new Scanner(System.in); 6 | System.out.println("Enter the String :"); 7 | String word = sc.nextLine(); 8 | int count=0; 9 | for(int i=0;i