Skip to main content
Commonmark migration
Source Link

Processing JS (modified) 121 bytes

var g="1N23456",a="",c=0; for(var i=0;i<a.length;i++){if(a[i]==="d"&&c>0){c--;}else if(c<6&&a[i]==="u"){c++;}}println(g[c]);

#Processing JS (modified) 121 bytes var g="1N23456",a="",c=0; for(var i=0;i<a.length;i++){if(a[i]==="d"&&c>0){c--;}else if(c<6&&a[i]==="u"){c++;}}println(g[c]); UngolfedUngolfed

var g=[1,"N",2,3,4,5,6],a="",c=0;
for(var i=0;i<a.length;i++)
{if(a[i]==="d"&&c>0)
{
    c--;

}else if(c<6&&a[i]==="u")
{
    c++;
    
}

}
println(g[c]);

Try it online!

I went with PJs since I know it well. The only problem is the version I use is very strictly typed. I can't leave out brackets and lots of other tricks. It is pretty simple. The input should go into the variable a and it takes lowercase u d. The program loops until it hits the end of the string and every iteration it checks to see if it is a u or a d. If it is and it won't try and "shift" past where you can it shifts. At the end I print the results!

#Processing JS (modified) 121 bytes var g="1N23456",a="",c=0; for(var i=0;i<a.length;i++){if(a[i]==="d"&&c>0){c--;}else if(c<6&&a[i]==="u"){c++;}}println(g[c]); Ungolfed

var g=[1,"N",2,3,4,5,6],a="",c=0;
for(var i=0;i<a.length;i++)
{if(a[i]==="d"&&c>0)
{
    c--;

}else if(c<6&&a[i]==="u")
{
    c++;
    
}

}
println(g[c]);

Try it online!

I went with PJs since I know it well. The only problem is the version I use is very strictly typed. I can't leave out brackets and lots of other tricks. It is pretty simple. The input should go into the variable a and it takes lowercase u d. The program loops until it hits the end of the string and every iteration it checks to see if it is a u or a d. If it is and it won't try and "shift" past where you can it shifts. At the end I print the results!

Processing JS (modified) 121 bytes

var g="1N23456",a="",c=0; for(var i=0;i<a.length;i++){if(a[i]==="d"&&c>0){c--;}else if(c<6&&a[i]==="u"){c++;}}println(g[c]);

Ungolfed

var g=[1,"N",2,3,4,5,6],a="",c=0;
for(var i=0;i<a.length;i++)
{if(a[i]==="d"&&c>0)
{
    c--;

}else if(c<6&&a[i]==="u")
{
    c++;
    
}

}
println(g[c]);

Try it online!

I went with PJs since I know it well. The only problem is the version I use is very strictly typed. I can't leave out brackets and lots of other tricks. It is pretty simple. The input should go into the variable a and it takes lowercase u d. The program loops until it hits the end of the string and every iteration it checks to see if it is a u or a d. If it is and it won't try and "shift" past where you can it shifts. At the end I print the results!

deleted 8 characters in body
Source Link
user63187
user63187

#Processing JS (modified) 132121 bytes var g=[1,"N",2,3,4,5,6]g="1N23456",a="",c=0; for(var i=0;i<a.length;i++){if(a[i]==="d"&&c>0){c--;}else if(c<6&&a[i]==="u"){c++;}}println(g[c]); Ungolfed

var g=[1,"N",2,3,4,5,6],a="",c=0;
for(var i=0;i<a.length;i++)
{if(a[i]==="d"&&c>0)
{
    c--;

}else if(c<6&&a[i]==="u")
{
    c++;
    
}

}
println(g[c]);

Try it online!

I went with PJs since I know it well. The only problem is the version I use is very strictly typed. I can't leave out brackets and lots of other tricks. It is pretty simple. The input should go into the variable a and it takes lowercase u d. The program loops until it hits the end of the string and every iteration it checks to see if it is a u or a d. If it is and it won't try and "shift" past where you can it shifts. At the end I print the results!

#Processing JS (modified) 132 bytes var g=[1,"N",2,3,4,5,6],a="",c=0; for(var i=0;i<a.length;i++){if(a[i]==="d"&&c>0){c--;}else if(c<6&&a[i]==="u"){c++;}}println(g[c]); Ungolfed

var g=[1,"N",2,3,4,5,6],a="",c=0;
for(var i=0;i<a.length;i++)
{if(a[i]==="d"&&c>0)
{
    c--;

}else if(c<6&&a[i]==="u")
{
    c++;
    
}

}
println(g[c]);

Try it online!

I went with PJs since I know it well. The only problem is the version I use is very strictly typed. I can't leave out brackets and lots of other tricks. It is pretty simple. The input should go into the variable a and it takes lowercase u d. The program loops until it hits the end of the string and every iteration it checks to see if it is a u or a d. If it is and it won't try and "shift" past where you can it shifts. At the end I print the results!

#Processing JS (modified) 121 bytes var g="1N23456",a="",c=0; for(var i=0;i<a.length;i++){if(a[i]==="d"&&c>0){c--;}else if(c<6&&a[i]==="u"){c++;}}println(g[c]); Ungolfed

var g=[1,"N",2,3,4,5,6],a="",c=0;
for(var i=0;i<a.length;i++)
{if(a[i]==="d"&&c>0)
{
    c--;

}else if(c<6&&a[i]==="u")
{
    c++;
    
}

}
println(g[c]);

Try it online!

I went with PJs since I know it well. The only problem is the version I use is very strictly typed. I can't leave out brackets and lots of other tricks. It is pretty simple. The input should go into the variable a and it takes lowercase u d. The program loops until it hits the end of the string and every iteration it checks to see if it is a u or a d. If it is and it won't try and "shift" past where you can it shifts. At the end I print the results!

Source Link
user63187
user63187

#Processing JS (modified) 132 bytes var g=[1,"N",2,3,4,5,6],a="",c=0; for(var i=0;i<a.length;i++){if(a[i]==="d"&&c>0){c--;}else if(c<6&&a[i]==="u"){c++;}}println(g[c]); Ungolfed

var g=[1,"N",2,3,4,5,6],a="",c=0;
for(var i=0;i<a.length;i++)
{if(a[i]==="d"&&c>0)
{
    c--;

}else if(c<6&&a[i]==="u")
{
    c++;
    
}

}
println(g[c]);

Try it online!

I went with PJs since I know it well. The only problem is the version I use is very strictly typed. I can't leave out brackets and lots of other tricks. It is pretty simple. The input should go into the variable a and it takes lowercase u d. The program loops until it hits the end of the string and every iteration it checks to see if it is a u or a d. If it is and it won't try and "shift" past where you can it shifts. At the end I print the results!