Many of you may have interacted with people from Russia on the internet at some point, and a subset of you may have noticed the slightly odd method they have of expressing themselves.
e.g. удали игру нуб)))
where the )))
are added for emphasis on the previous statement, I have been working on a theory that the ratio of )
's to the rest of the string is directly proportional to the amount of implied emphasis, however I oftentimes find it difficult to compute the ratio on the fly, as I am also trying to cope with a slew of abuse, so I would like the shortest possible code to help me calculate what the resulting string should be, for a value of enthusiasm between 0 and 500%, given the original, unenthusiastic string, this will aid my research greatly as I will not have to type out bulky scripts every time I wish to test my hypothesis.
So, the challenge:
write a full program or function, which, provided two arguments, a string of unknown length, and a number, in either integer format (between 0 and 500) or in decimal format (between 0 and 5, with 2 points of accuracy) will
- return/display the original string, suffixed with a number of
)
's - the number will be the calculated as a ratio of the input number to the string length.
- so if the number 200, or 2.00 was provided, 200% of the string must be suffixed as
)
's - the number of brackets rounded to in decimal situations does not matter.
- script is required to support Printable ASCII characters.
- only has to support one input number format, of your choice.
Examples:
"codegolf" 125 = codegolf))))))))))
"codegolf" 75 = codegolf))))))
"noob team omg" 0.5 = noob team omg))))))
"hi!" 4.99 = hi!)))))))))))))))
Example code (PowerShell) (with decimal input):
Function Get-RussianString ([string]$InputStr,[decimal]$Ratio){
$StrLen = $InputStr.Length
$SuffixCount = $StrLen * $Ratio
$Suffix = [string]::New(")",$SuffixCount)
return $InputStr + $Suffix
}
Get-RussianString "codegolf" 0.5
codegolf))))
This is code-golf so shortest code wins!
)
for emphasis like an!
? Is it some encoding issue? \$\endgroup\$!
s, but they do type them as is, it's not super common, but it's quite iconic. \$\endgroup\$)
is reduced emoticon:)
. It is used very common between young people as far as I know. \$\endgroup\$)
is not an emphasis, it is simply the smiley. As far as I know, it is harder to type:
when using Russian keyboard layout, therefore they smile without eyes. \$\endgroup\$:
on Russian layout (ЙЦУКЕН) as it is to type^
on QWERTY. But indeed, the)
is a reduced version of:)
. It's much easier to press and hold Shift-0 than to repeatedly alternate keys. \$\endgroup\$