Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	// var w, h int
	for scanner.Scan() {
		// fmt.Scanf("%d %d", &w, &h)

		input := strings.Split(scanner.Text(), " ")
		w, _ := strconv.Atoi(input[0])
		h, _ := strconv.Atoi(input[1])

		if w == 0 && h == 0 {
			return
		}

		isArrive := make([][]bool, w)
		tiles := make([][]string, w)

		for i := 0; i < w; i++ {
			rowArrive := make([]bool, h)
			rowTiles := make([]string, h)
			scanner.Scan()
			row := scanner.Text()
			for j := 0; j < h; j++ {
				rowTiles[j] = string(row[j])
			}
			tiles[i] = rowTiles
			isArrive[i] = rowArrive
		}

		var i, j int
		isEnd := false
		for {
			if isArrive[i][j] == true {
				fmt.Println("LOOP")
				break
			}
			isArrive[i][j] = true

			switch tiles[i][j] {
			case ">":
				j++
			case "^":
				i--
			case "v":
				i++
			case "<":
				j--
			case ".":
				isEnd = true
			}

			if isEnd == true {
				fmt.Println(j, i)
				break
			}
		}
	}
}

C++: 

#include<iostream>
#include<vector>
#include<string>

using namespace std;

char f[128][128];
int judge[128][128];
int ex, ey;

void move(int i, int j)
{
	//printf("%3d:%3d\n", i, j);
	if(judge[i][j] == 1)
	{
		ex = -1; ey = -1;
		return;
	}
	else if(f[i][j] == '.')
	{
		ex = j; ey = i;
		return;
	}

	judge[i][j] = 1;

	if(f[i][j] == '>')
	{
		move(i, j+1);
	}
	else if(f[i][j] == '<')
	{
		move(i, j-1);
	}
	else if(f[i][j] == '^')
	{
		move(i-1, j);
	}
	else if(f[i][j] == 'v')
	{
		move(i+1, j);
	}

}

int main()
{
	int w, h;
	while(cin >> h >> w)
	{
		if(h == 0 && w == 0) break;
		for(int i = 0; i < h; i++)
		{
			cin >> f[i];
		}
		/*
		   for(int i = 0; i < h; i++)
		   {
		   for(int j = 0; j < w; j++)
		   {
		   cout << f[i][j];
		   }
		   cout << endl;
		   }
		   */
		//cout << "Run" << endl;
		move(0, 0);
		//cout << "Finish" << endl;

		if(ex == -1 && ey == -1)
		{
			cout << "LOOP" << endl;
		}
		else
		{
			cout << ex << ' ' << ey << endl;
		}
	}
}

C++: #include<iostream>

using namespace std;
int H, W;
int x = 0, y = 0;
int rog[100][100];
bool check(){
	if (rog[x][y] == 0){
		cout << "LOOP" << endl;
		return true;
	}
	
		return false;
	
}
int main(){
	char ma[100][100];

	while (cin >> H >> W,W+H){

		int x = 0, y = 0;
		ma[100][100] = {};
		for (int i = 0; i < H; i++){
			for (int j = 0; j < W; j++){
				cin >> ma[i][j];
				rog[i][j] = 1;
			}
		}
		while (1){
			if (ma[x][y] == '>'){
				x++;
				if (check())break; 
			}
			else if(ma[x][y]=='v'){
				y++;
				if (check()) break; 
			}
			else if (ma[x][y] == '<'){
				x--;
				if (check()) break; 
			}
			else if (ma[x][y] == '^'){
				y--;
				if (check())break; 
			}
			else {
				cout << x << " " << y << endl;
				break;
			}
			
			rog[x][y] = 0;

		}
	}
	return 0;
}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))




int main(){
	vector <string>res;
	while(1){
		int H,W;
		cin>>H>>W;
		if(H==0&&W==0)break;
		char c[102][102];
		REP(i,H)REP(j,W)cin>>c[i][j];
		int tx=0,ty=0;
		int x=0,y=0;
		vector<PII>pi;
		set<PII>sp;
		int cnt=0;
		bool ch=true;
		while(c[y][x]!='.'){
			sp.insert(MP(x,y));
			if(c[y][x]=='>'){
				tx=1;ty=0;
			}else if(c[y][x]=='v'){
				tx=0;ty=1;
			}else if(c[y][x]=='<'){
				tx=-1;ty=0;
			}else if(c[y][x]=='^'){
				tx=0;ty=-1;
			}
			x+=tx;y+=ty;
			if(sp.find(MP(x,y))!=sp.end()){
				ch=false;
				break;
			}
		}
		if(ch){
			res.PB(toString(x)+' '+toString(y));
		}else{
			res.PB("LOOP");
		}
	}
	REP(i,SZ(res))cout<<res[i]<<endl;
}

C++: #include<iostream>
#include<string>
using namespace std;

struct Point{
	int x; int y; Point(){ x = 0; y = 0; }
};

int main(){
	const int h_max = 101;
	const int w_max = 101;
	int h, w;
	int a[h_max][w_max];

	while (cin >> h >> w , h*w != 0){

	for (int i = 0; i < h_max; ++i){
		for (int j = 0; j < w_max; ++j){
			a[i][j] = 0;
		}
	}

	
		string s;
		for (int i = 0; i < h; ++i){
			cin >> s;
			for (int j = 0; j < s.length(); ++j){
				switch ((int)s[j]){
				case (int)'>':
					a[j][i] = 1;
					break;
				case (int)'<':
					a[j][i] = 2;
					break;
				case (int)'^':
					a[j][i] = 3;
					break;
				case (int)'v':
					a[j][i] = 4;
					break;
				case (int)'.':
					a[j][i] = 5;
					break;
				}
			}
		}


		Point p;
		int count = 0; bool  is_loop = false;
		while (a[p.x][p.y] != 5 && is_loop == false){
			switch (a[p.x][p.y])
			{
			case 1:
				++p.x;
				break;
			case 2:
				--p.x;
				break;
			case 3:
				--p.y;
				break;
			case 4:
				++p.y;
				break;
			}

			++count;
			if (count > 101 * 101){
				is_loop = true;
			}
		}
		if (!is_loop){
			cout << p.x << " " << p.y << endl;
		}
		else{
			cout << "LOOP" << endl;
		}
	}
	
	/*
	for (int i = 0; i < h_max; ++i){
		for (int j = 0; j < w_max; ++j){
			cout << a[i][j];
		}
		cout << endl;
	}
	*/
	


	return 0;
}

C++: #include<iostream>
using namespace std;

char map[101][101];
int f[101][101];

int main() {
	int w, h, x, y, e;
	while(1) {
		cin >> h >> w;
		if(!w&&!h) break;
		for(int i=0; i<h; ++i) {
			cin >> map[i];
			for(int j=0; j<w; ++j) f[i][j] = 0;
		}
		x = y = 0; e = 0;
		while(1) {
			f[y][x] = 1;
			switch(map[y][x]) {
			case '>': x+=1; break;
			case '<': x-=1; break;
			case 'v': y+=1; break;
			case '^': y-=1; break;
			case '.': e = 1; break;
			}
			if(e || f[y][x]) break;
		}
		if(e) cout << x << " " << y << endl;
		else cout << "LOOP" << endl;
	}
	return 0;
}