Page 365 - Computer science 868 Class 12
P. 365
29 break;
30 }
31 }
32 if (seen)
33 {
34 continue;
35 }
36 int f = 1;
37 for (int k = i + 1; k < len; k++)
38 {
39 if (ch == str.charAt(k))
40 {
41 f++;
42 }
43 }
44 arr1[index] = ch;
45 frarr[index] = f;
46 index++;
47 }
48 for (i = 0; i < index; i++)
49 {
50 System.out.print(arr1[i] + " ");
51 }
52 System.out.println();
53 for (i = 0; i < index; i++)
54 {
55 System.out.print(frarr[i] + " ");
56 }
57 }
58 }
The output of the preceding program is as follows:
Enter a string:
You may go now.
Y o u m a y g n w .
1 3 1 1 1 1 1 1 1 1
363
Strings 363

