-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcharno.java
More file actions
51 lines (51 loc) · 776 Bytes
/
Copy pathcharno.java
File metadata and controls
51 lines (51 loc) · 776 Bytes
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
import java.util.*;
class charno
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
String s=sc.nextLine();
StringBuffer sb=new StringBuffer();
String str="";
int i,j;
//int p=0,nmbr=0;
for(i=0;i<s.length();i++)
{
if((s.charAt(i)>=65 && s.charAt(i)<=90)||(s.charAt(i)>=97&&s.charAt(i)<=122))
{
str=str+s.charAt(i);
}
else if(s.charAt(i)>=48 && s.charAt(i)<=57)
{
int p=0;
int nmbr=0;
for(j=i;j<s.length();j++)
{
if(s.charAt(j)>=48 && s.charAt(j)<=57)
{
nmbr*=10;
p=s.charAt(j)-48;
nmbr+=p;
}
else
{
i=j-1;
for(j=0;j<nmbr;j++)
{
sb.append(str);
}
str="";
break;
}
}
//System.out.println(nmbr);
for(j=0;j<nmbr;j++)
{
sb.append(str);
}
}
}
String output=new String(sb);
System.out.println(output);
}
}