-
Notifications
You must be signed in to change notification settings - Fork 0
/
Wipro technologies
30 lines (29 loc) · 1.03 KB
/
Wipro technologies
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
String[] s={input1,input2};
String[] front=new String[3];
String[] middle=new String[3];
String[] end=new String[3];
String ans;
int l;
for(int i=0;i<2;i++)
{
l=s[i].length();
if(l%3==2)
{
front[i]=s[i].substring(0,(l/3)+1);
middle[i]=s[i].substring((l/3)+1,2*(l/3)+1);
end[i]=s[i].substring(2*(l/3)+1);
}
else if(l%3==1)
{
front[i]=s[i].substring(0,(l/3));
middle[i]=s[i].substring((l/3),2*(l/3)+1);
end[i]=s[i].substring(2*(l/3)+1);
}
else
{
front[i]=s[i].substring(0,(l/3));
middle[i]=s[i].substring((l/3),2*(l/3));
end[i]=s[i].substring(2*(l/3));
}
ans=front[1]+front[0]+end[2];( Based on question check ) only this line in front array alll words front part middle one middle part . if word 1 then front[0]
}