ba1i.c3 (625B) - raw


      1 // Frequent words with mismatches
      2 
      3 module ba1i;
      4 import std::io;
      5 import std::io::file;
      6 import std::collections;
      7 
      8 import util;
      9 
     10 fn int main(String[] args) {
     11 	if (args.len != 2) {
     12 		io::eprintn("Please supply path to data file");
     13 		return 1;
     14 	}
     15 	File f = file::open(args[1], "rb")!!;
     16 	String genome = io::treadline(&f)!!;
     17 	String ints = io::treadline(&f)!!;
     18 	String[] ints_split = ints.tsplit(" ");
     19 	int k = ints_split[0].to_integer(int)!!;
     20 	int d = ints_split[1].to_integer(int)!!;
     21 	String[] matches = util::frequent_words_with_mismatches(genome, k, d);
     22 	foreach (match : matches) {
     23 		io::printf("%s ", match);
     24 	}
     25 	return 0;
     26 }