Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

A Program to check if a string is unique or not

eg:Sample Input:COMPUTER
Sample Output:Unique string
import java.io.*;
class A
{
     BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
     String str1;
     int i,j,len;
     void take() throws Exception
     {
          System.out.print("\nEnter the sentence: ");
          str1=br.readLine();
          len=str1.length();
          for(i=0;i          {
               for(j=i+1;j               {
                   if(str1.charAt(i)==str1.charAt(j))
                   break;
                }
                if(j                break;
            }
            if(i            System.out.print("\nNot Unique character string.");
            else
            System.out.print("\nUnique character string.");
        }
    }
  


This post first appeared on Tutorial Site On Computer Programming Languages F, please read the originial post: here

Share the post

A Program to check if a string is unique or not

×

Subscribe to Tutorial Site On Computer Programming Languages F

Get updates delivered right to your inbox!

Thank you for your subscription

×