Problem 4 solved (these are a bit easy with standard libraries... maybe consider not using them)