Source Code CharacterByte Frequency code-golf- Posted here
Write a program using SBCS that get a single byte character as an input and prints the frequency of that character in the program's source code (percentage format) as an output.
Example:
Assuming my program is: ab#cd%b then the output of Changes from the program should beoriginal idea:
input output ----- ------ a 14.29% b 28.57% # 14.29% c 14.29% d 14.29% % 14.29% Notes:
- Output must be in percentage formatWithout the requirement of fixed representation of the result (percentage and trimming).
- Printed valueWith constraint: source code must be with 2 digits after decimal (Print 15.00%, not 15%. print 15.12%, not 15.12345%).at least 1 byte long
- You man trimChanged from character to byte, plus removing the restconstraint of the digits after decimal in any way you want (ceiling, round, floor, simple trimming, ..SBCS languages only.)
Scoring:
This is code-golf - the shortest code wins.