-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathwttest.java
More file actions
86 lines (66 loc) · 1.3 KB
/
wttest.java
File metadata and controls
86 lines (66 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import java.io.*;
import java.util.*;
class wttest
{
public static void main(String args[])
{
char ch[][]=new char[50][6];
char s='0';
int rlen=0;
System.out.println("Enter the sentence");
Scanner obj=new Scanner(System.in);
String str=obj.nextLine();
char x[]=str.toCharArray();
System.out.println("The character array now is--: ");
for(int i=0;i<x.length;i++)
{
System.out.print(x[i]);
}
System.out.println("\n");
int a=0;
for(int i=0;i<50&&a<(x.length);i++,a++,rlen++)
{
for(int j=0;j<6;j++,a++)
{ s=x[a];
if(s!='.'&&s!=' ')
ch[i][j]=s;
else if(s==' ')
ch[i][j]='*';
else
{
while(j<6)
{
ch[i][j]='.';
j++;
}
break;
}
}
if(s=='.')
break;
a--;
}
System.out.println("The sentence you entered is-----"+"\n\n");
for(int i=0;i<=rlen;i++)
{
for(int j=0;j<6;j++)
{
System.out.print(ch[i][j]+" ");
}
System.out.println("\n");
}
char res[]=new char[50];
int d=0;
System.out.println("The output sentence you want is-----"+"\n\n");
for(int j=0;j<6;j++)
{
for(int i=0;i<=rlen;i++)
{
res[d]=ch[i][j];
d++;
}
}
String ss=new String(res);
System.out.println(ss);
}
}