0% found this document useful (0 votes)
12 views10 pages

Find Unique and Duplicate Characters

Uploaded by

padma
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views10 pages

Find Unique and Duplicate Characters

Uploaded by

padma
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

how to find duplicate character from string?

how to find unique character from String?


count occurance of character from string?
find duplicate character and print its occurance?
find unique character and print its occurance?
how to find first non repeated character from String?
============================================================

package tutorial18;

import [Link];

public class Demo1 {

public static void main(String[] args) {

//how to find duplicate character from string?

String a = "selenium";

int[] abc = new int[256];

for (int i = 0; i < [Link](); i++)


{
char value = [Link](i);

int xyz = value;

abc[xyz] = abc[xyz] + 1;

for (int i = 0; i < [Link]; i++)


{
if(abc[i] > 1)
{
[Link]((char)i) ;
}

===============================================================================

package tutorial18;

import [Link];

public class Demo1 {

public static void main(String[] args) {

//how to find unique character from String?


String a = "selenium";

int[] abc = new int[256];

for (int i = 0; i < [Link](); i++)


{
char value = [Link](i);

int xyz = value;

abc[xyz] = abc[xyz] + 1;

for (int i = 0; i < [Link]; i++)


{
if(abc[i] == 1)
{
[Link]((char)i) ;
}

===============================================================================
package tutorial18;

import [Link];

public class Demo1 {

public static void main(String[] args) {

//print character and its occurrence of character from string?

String a = "selenium";

int[] abc = new int[256];

for (int i = 0; i < [Link](); i++)


{
char value = [Link](i);

int xyz = value;

abc[xyz] = abc[xyz] + 1;

for (int i = 0; i < [Link]; i++)


{
if(abc[i] >= 1)
{
[Link]((char)i + " :: "+abc[i]) ;
}
}

}
===============================================================================
package tutorial18;

import [Link];

public class Demo1 {

public static void main(String[] args) {

//find duplicate character from string and print its occurance?

String a = "selenium";

int[] abc = new int[256];

for (int i = 0; i < [Link](); i++)


{
char value = [Link](i);

int xyz = value;

abc[xyz] = abc[xyz] + 1;

for (int i = 0; i < [Link]; i++)


{
if(abc[i] > 1)
{
[Link]((char)i + " :: "+abc[i]) ;
}

===============================================================================
package tutorial18;

import [Link];

public class Demo1 {

public static void main(String[] args) {

//find unique character and print its occurrence?

String a = "selenium";
int[] abc = new int[256];

for (int i = 0; i < [Link](); i++)


{
char value = [Link](i);

int xyz = value;

abc[xyz] = abc[xyz] + 1;

for (int i = 0; i < [Link]; i++)


{
if(abc[i] == 1)
{
[Link]((char)i + " :: "+abc[i]) ;
}

===============================================================================
package tutorial18;

import [Link];

public class Demo1 {

public static void main(String[] args) {

//how to find first non repeated character from String?

String a = "aabaaabaap";

int[] abc = new int[256];

for (int i = 0; i < [Link](); i++)


{
char value = [Link](i);

int xyz = value;

abc[xyz] = abc[xyz] + 1;

for (int i = 0; i < [Link]; i++)


{
if(abc[i] == 1)
{
[Link]((char)i + " :: "+abc[i]) ;
break;
}
}

===============================================================================
ASCII Value

A 65
B 66
C 67
Z 90

a 97 0 2
b 98
c 99
d 100
e 101
f 102
g 103
h 104
i 105
j 106 0 1

p
q
r
s
t
u
v 118 0 1
w 119
x 120
y 121
z 122

-----------------------------------------------------------------------------------
--------------------------------------------------
how to find duplicate character from string?

String a = "java";

int [] abc = new int[256]; // [0, 0, 0, 0, 0, 0, ]

for(int i=0; i < [Link](); i++)


{
char value = [Link][i];

abc[value] = abc[value] +1; // 0 + 1

for(int i=0; i<[Link]; i++)


{
if(abc[i] > 1)
{
[Link]((char)i);
}
}

-----------------------------------------------------------------------------------
--------------------------------------------------
package tutorial17;

import [Link];

public class Demo10 {

public static void main(String[] args) {

int[] abc = {
91, 23, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 317, 138, 19, 20,
21, 22, 23, 254, 245, 26,217, 328, 259, 330,
331, 312, 353, 34,335, 536, 357, 388, 369, 40,
451, 432, 453, 444, 435, 446, 447, 484, 449, 540
};

[Link](abc[32]); //353

[Link]("----------------------------------");

[Link](abc[37]);// 388

[Link](abc['%']);// 388

[Link]("----------------------------------");

[Link](abc[41]); //432

[Link](abc[')']); //432

[Link]("----------------------------------");
[Link](abc[48]); //449

[Link](abc['0']); //449
}

-----------------------------------------------------------------------------------
--------------------------------------------------
package tutorial18;

import [Link];

public class Demo1 {

public static void main(String[] args) {

String a="test";
int [] abc =new int[256];

for(int i=0; i<[Link](); i++)


{
char value = [Link](i);

int xyz = value;

abc[xyz] = abc[xyz]+1;

for(int i=0; i<[Link]; i++)


{

if(abc[i] > 1)
{
[Link](i);

[Link]((char)i);

}
}

}
=====================================================================
package tutorial18;

import [Link];

public class Demo1 {

public static void main(String[] args) {

String a = "test";

int[] abc = new int[256];

for (int i = 0; i < [Link](); i++)


{
char value = [Link](i);

int xyz = value;

abc[xyz] = abc[xyz] + 1;

for (int i = 0; i < [Link]; i++)


{

if(abc[i] > 1)
{
[Link](i);

[Link]((char) i);

}
================================================================================
package tutorial18;

import [Link];

public class Demo1 {

public static void main(String[] args) {

//Unique values

String a = "test";

int[] abc = new int[256];

for (int i = 0; i < [Link](); i++)


{
char value = [Link](i);

int xyz = value;

abc[xyz] = abc[xyz] + 1;

for (int i = 0; i < [Link]; i++)


{

if(abc[i] == 1)
{
//[Link](i);

[Link]((char) i);

}
=============================================================================
package tutorial18;
import [Link];

public class Demo1 {

public static void main(String[] args) {

//Occurance

String a = "rest test jenkins";

int[] abc = new int[256];

for (int i = 0; i < [Link](); i++)


{
char value = [Link](i);

int xyz = value;

abc[xyz] = abc[xyz] + 1;

for (int i = 0; i < [Link]; i++)


{
if(abc[i]>=1)
{
[Link]((char) i +":: count : "+ abc[i]) ;

}
==============================================================================
package tutorial18;

import [Link];

public class Demo1 {

public static void main(String[] args) {

//find only first non repeated character from string

String a = "aabababapssuttrss";

int[] abc = new int[256];

for (int i = 0; i < [Link](); i++)


{
char value = [Link](i);

int xyz = value;

abc[xyz] = abc[xyz] + 1;
}

for (int i = 0; i < [Link]; i++)


{
if(abc[i] == 1)
{
[Link]((char) i +":: count : "+ abc[i]) ;
break;
}

}
==========================================================================
package tutorial18;

import [Link];

public class Demo1 {

public static void main(String[] args) {

//find unique character and print its occurance

String a = "automation";

int[] abc = new int[256];

for (int i = 0; i < [Link](); i++)


{
char value = [Link](i);

int xyz = value;

abc[xyz] = abc[xyz] + 1;

for (int i = 0; i < [Link]; i++)


{
if(abc[i] == 1)
{
[Link]((char) i +":: count : "+ abc[i]) ;
}

}
=====================================================================

You might also like