done through reverse string, some lecture exercises