submitted. still doesnt work for test case 2 but no time to fix.