--- /dev/null
+//! Copyright (C) 2023 Gustav Eek <gustav.eek@fripost.org>
+//!
+//! SPDX-License-Identifier: GPL-3.0-or-later
+
+use std::io; // bring flush() into scope with `use std::io::Write`
+use std::io::prelude::*; // Bring `std::io::BufRead` in scope
+
+fn input() -> Vec<String> {
+ // Consider datastructure some list of strings
+ let stdin = io::stdin();
+ let v = stdin.lock().lines().map(|x| x.unwrap()).collect();
+ v
+}
+
+fn output(prio: Vec<f64>, ranked: Vec<String>) {
+ for (p, l) in prio.iter().zip(ranked.iter()) {
+ println!("{:2.0} %\t{}", p * 100.0, l);
+ }
+}
+
+fn delta(n: i32) -> Vec<f64> {
+ let mut ret: Vec<f64> = Vec::new();
+ for _i in 0..n {
+ ret.push(1.0 / n as f64);
+ }
+ ret
+}
+
+fn main() {
+ let ranked: Vec<String> = input();
+ let num = ranked.len() as i32;
+ let prio = delta(num);
+ for p in prio.iter() {
+ eprint!("{} ", p);
+ }
+ eprintln!("");
+ for l in ranked.iter() {
+ eprint!("{} ", l);
+ }
+ eprintln!("");
+ eprintln!("That was {} items: {}", num, prio[0]);
+
+ output(prio, ranked);
+
+}