25 lines
705 B
Plaintext
25 lines
705 B
Plaintext
use std::collections::HashMap;
|
|
use std::fs::File;
|
|
use std::io::prelude::*;
|
|
|
|
fn main() -> std::io::Result<()> {
|
|
let mut file = File::open("test.txt")?;
|
|
let mut contents = String::new();
|
|
let mut hashmap: HashMap<char, i32> = HashMap::new();
|
|
file.read_to_string(&mut contents)?;
|
|
for c in contents.chars() {
|
|
if let Some(value) = hashmap.get(&c) {
|
|
hashmap.insert(value, hashmap.get(value) + 1);
|
|
}
|
|
//println!("{:?}", contents.chars().nth(i));
|
|
}
|
|
/*
|
|
contents.push('é');
|
|
let mut file2 = File::create("fo.txt")?;
|
|
let test: i64 = 10000000;
|
|
//writeln!(file2, "{}", test)?;
|
|
file2.write_all(&test.to_be_bytes())?;
|
|
*/
|
|
Ok(())
|
|
}
|