diff --git a/alphabetspam/input.txt b/alphabetspam/input.txt new file mode 100644 index 0000000..85ba69e --- /dev/null +++ b/alphabetspam/input.txt @@ -0,0 +1 @@ +Welcome_NWERC_participants! \ No newline at end of file diff --git a/alphabetspam/output.txt b/alphabetspam/output.txt new file mode 100644 index 0000000..99b905f --- /dev/null +++ b/alphabetspam/output.txt @@ -0,0 +1,5 @@ +Welcome_NWERC_participants! +0.1 +0.2 +0.3 +0.4 diff --git a/alphabetspam/stub.dsl b/alphabetspam/stub.dsl new file mode 100644 index 0000000..cb87f43 --- /dev/null +++ b/alphabetspam/stub.dsl @@ -0,0 +1,4 @@ +function(float_array, calculateRatios, string processedString) +string(processedString) +invoke(float_array, ratios, calculateRatios, processedString) +print(float_array, ratios, \n) \ No newline at end of file diff --git a/alphabetspam/stub.js b/alphabetspam/stub.js new file mode 100644 index 0000000..21caeec --- /dev/null +++ b/alphabetspam/stub.js @@ -0,0 +1,50 @@ +'use strict'; + +const fs = require('fs'); + +process.stdin.resume(); +process.stdin.setEncoding('utf-8'); + +let inputString = ''; +let currentLine = 0; + +process.stdin.on('data', function(inputStdin) { + inputString += inputStdin; +}); + +process.stdin.on('end', function() { + inputString = inputString.split('\n'); + + main(); +}); + +function readLine() { + return inputString[currentLine++]; +} + +/* + * Complete the 'calculateRatios' function below. + * + * The function is expected to return a FLOAT_ARRAY. + * The function accepts STRING processedString as parameter. + */ + +function calculateRatios(processedString) { + // Write your code here + + console.log(processedString) + let testResult = [0.1, 0.2, 0.3, 0.4] + return testResult +} + +function main() { + const ws = process.stdout; + + const processedString = readLine(); + + const ratios = calculateRatios(processedString); + + ws.write(ratios.join('\n') + '\n'); + + ws.end(); +}