Repeat or multiply?

Input:
String or number (int, float)
Integer (n)
Output:
If input is string — print n strings
If it's number — print n*number

IN

3
2

OUT

6

IN

123.2
1

OUT

123.2

IN

123a
2

OUT

123a123a

IN

jagc 
66

OUT

jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc jagc 

IN

2.25
2

OUT

4.5

IN

3456765432
3456765432

OUT

11949227251870146624

IN

 
12

OUT

            
Login to submit solution


7 symbols pyth
Mon Sep 19 13:21:02 2016 Sait2000
*.xvzzE
35 symbols perl
Sat Aug 13 23:47:23 2016 vakorol
#!/usr/bin/perl -p
$n=<>;$_=/ |a/?chop&&$_ x$n:$_*$n
40 symbols perl
Wed Jan 14 02:34:33 2015 beched
#!/usr/bin/perl -p0aF\n
($_,$b)=@F;$_=/[a ]/?$_ x$b:$_*$b
42 symbols perl
Wed Aug 27 04:40:32 2014 gabrielmad
#!/usr/bin/perl -p0aF\n
($_,$b)=@F;$_=/[a-z ]/?$_ x$b:$_*$b
49 symbols perl
Sun Aug 24 11:54:28 2014 gabrielmad
#!/usr/bin/perl -p0
($_,$b)=split"\n";$_=/^(\d|\.)+$/?$_*$b:$_ x$b
52 symbols python2
Tue Oct 25 16:01:26 2016 Sait2000
a=raw_input()
try:a=eval(a)
except:0
print a*input()
55 symbols perl
Tue Sep 16 01:03:21 2014 maxymania
$_=<>;chomp;$b=<>;chomp$b;print m'[^\d.]'?$_ x$b:$_*$b;
60 symbols perl
Sat Aug 2 18:37:01 2014 danieljabailey
#!/usr/bin/perl
$_=<>;chop;$b=<>;print($_=~m/[1-9]+\.?[1-9]*$/?$_*$b:$_ x$b)
76 symbols python2
Tue Aug 18 20:04:08 2015 Sait2000
a=raw_input()
try:a=int(a)
except:
 try:a=float(a)
 except:0
print a*input()
79 symbols python2
Mon Aug 11 20:01:52 2014 PFischbeck
a=raw_input()
try:a=int(a)
except:
 try:a=float(a)
 except:pass
print a*input()
79 symbols python2
Mon Aug 11 23:22:48 2014 LLcoolNJ
a=raw_input()
try:a=int(a)
except:
 try:a=float(a)
 except:pass
print a*input()
93 symbols python3
Fri Aug 8 22:48:11 2014 z423x5c6
i=input
a=i()
b=int(i())
try:
 a=int(a)
except:
 try:
  a=float(a)
 except:
  pass
print(b*a)
98 symbols python2
Wed Jul 30 00:29:29 2014 vik
a=raw_input()
n=input()
try:
  a=int(a)
except:
  try:
    a=float(a)
  except:
    pass
print a*n
143 symbols python3
Fri Aug 8 22:46:16 2014 z423x5c6
i=input
a=i()
b=int(i())
try:
    a=int(a)
    print(b*a)
except:
    try:
        a=float(a)
        print(b*a)
    except:
        print(b*a)
168 symbols haskell
Fri Mar 13 15:04:08 2015 YoshikuniJujo
main=interact$(\[s,t]->r s$read t).lines
d="0123456789"
r""_=""
r s t|all(`elem`d)s=show$read s*(floor t)|all(`elem`'.':d)s=show$read s*t|0<1=concat$replicate(floor t)s

View all solutions