public class Solution {
public int atoi(String str) {
// Start typing your Java solution below
// DO NOT write main() function
str = str.trim();
boolean neg = false;
int start = 0;
if(str.length()==0) return 0;
if(str.charAt(0)=='+'){
start = 1;
}else if(str.charAt(0)=='-'){
start = 1;
neg = true;
}
long ans = 0;
for(int i=start;i