Language: C

Last login: Wed Aug  9 23:24:03 on ttys000
MacBook-Pro:~ Toshiba$ ssh aizu
PAM Authentication
Password: 
bind: Address already in use
channel_setup_fwd_listener_tcpip: cannot listen to port: 9999
Could not request local forwarding.
Last login: Wed Aug 09 2017 23:29:53 +0900 from p8fbd796d
Oracle Corporation     SunOS 5.11      11.3    January 2017

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- Solaris11:
  - Computer Exercise Room 1 and 2  ... std1dc2 - std1dc46, std2dc2 - std2dc46
  - Computer Exercise Room 3 and 4  ... std34rsv1 - std34rsv5
  - Standard Environment Server     ... solsv171 - solsv174
- OS X 10.9:
  - Computer Exercise Room 5 and 6  ... std5dc2 - std5dc50, std6dc2 - std6dc50
  - iLab 1 and 2                ... ilab1dc2 - ilab1dc49, ilab2dc2 - ilab2dc49
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Terminal type is xterm-256color.                                        
-bash-4.4$ cd algo1/le08
-bash-4.4$ emacs C.c

























-bash-4.4$ emacs C.c
-bash-4.4$ ls
A.c  A.c~  B.c  B.c~  C.c  C.c~  a.out
-bash-4.4$ cd ..
-bash-4.4$ cd le04
-bash-4.4$ ls
A.c  A.c~  B.c  B.c~  C.c  C.c~  a.out
-bash-4.4$ emacs C.c
-bash-4.4$ emacs C.c
-bash-4.4$ rm C.c
-bash-4.4$ emacs C.c
-bash-4.4$ gcc C.c
C.c: In function 'main':
C.c:26:7: warning: passing argument 1 of 'insert' makes integer from pointer without a cast [enabled by default]
       if (c[0]=='i')   insert(str);
       ^
C.c:11:5: note: expected 'char' but argument is of type 'char *'
 int insert(char);
     ^
C.c:29:4: warning: passing argument 1 of 'search' makes integer from pointer without a cast [enabled by default]
    if (search(str))  printf("yes\n");
    ^
C.c:10:5: note: expected 'char' but argument is of type 'char *'
 int search(char);
     ^
C.c: At top level:
C.c:42:11: error: conflicting types for 'getKey'
 long long getKey(char str[])
           ^
C.c:7:11: note: previous declaration of 'getKey' was here
 long long getKey(char);
           ^
C.c:74:5: error: conflicting types for 'insert'
 int insert(char str[])
     ^
C.c:11:5: note: previous declaration of 'insert' was here
 int insert(char);
     ^
-bash-4.4$ emacs C.c
-bash-4.4$ gcc C.c
Undefined                       first referenced
 symbol                             in file
search                              /var/tmp//ccjspEUa.o
ld: fatal: symbol referencing errors
collect2: error: ld returned 1 exit status
-bash-4.4$ emacs C.c
-bash-4.4$ gcc C.c
-bash-4.4$ emacs C.c
-bash-4.4$ pwd
/home/student/s1240089/algo1/le04
-bash-4.4$ cd ..
-bash-4.4$ cd le10
-bash-4.4$ emacs C.c
-bash-4.4$ emacs C.c
-bash-4.4$ gcc C.c
-bash-4.4$ ./a.out
3
abcbdab
bdcaba
Segmentation Fault (core dumped)
-bash-4.4$ emacs C.c
-bash-4.4$ gcc C.c
-bash-4.4$ ./a.out
abcbdab
-bash-4.4$ gcc C.c
-bash-4.4$ ./a.out
abcbdab
-bash-4.4$ emacs C.c
-bash-4.4$ emacs C.c
-bash-4.4$ gcc C.c
C.c: In function 'lcs':
C.c:27:7: error: 'c' undeclared (first use in this function)
       c[i][0]=0;
       ^
C.c:27:7: note: each undeclared identifier is reported only once for each function it appears in
-bash-4.4$ emacs C.c
-bash-4.4$ gcc C.c
-bash-4.4$ emacs C.c

File Edit Options Buffers Tools C Help                                          
#include <stdio.h>
#include <string.h>
#define N 1000
char s1[N+1],s2[N+1];
int c[N+1][N+1];

int lcs(void);
int max(int,int);
int main()
{
  int i,n;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      scanf("%s%s",s1,s2);
      printf("%d\n",lcs());
    }
  return 0;
}

int lcs()
{
  int i,j,m,n;
  m=strlen(s1);
  n=strlen(s2);
  for(i=1;i<=m;i++)
    {
      c[i][0]=0;
    }
  for(i=1;i<=n;i++)
    {
      c[0][i]=0;
    }
  for(i=1;i<=m;i++)
    {
      for(j=1;j<=n;j++)
        {
          if(s1[i-1]==s2[j-1])     c[i][j]=c[i-1][j-1]+1;
          else if(c[i-1][j]>=c[i][j-1]) c[i][j]=c[i-1][j];
          else  c[i][j]=c[i][j-1];

        }
    }
  return c[m][n];
}

Compiler output:
main.c:1:1: error: unknown type name 'Last'
    1 | Last login: Wed Aug  9 23:24:03 on ttys000
      | ^~~~
main.c:1:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
    1 | Last login: Wed Aug  9 23:24:03 on ttys000
      |           ^
main.c:8:21: error: invalid digit "9" in octal constant
    8 | Last login: Wed Aug 09 2017 23:29:53 +0900 from p8fbd796d
      |                     ^~
main.c:8:39: error: invalid digit "9" in octal constant
    8 | Last login: Wed Aug 09 2017 23:29:53 +0900 from p8fbd796d
      |                                       ^~~~
main.c:20:24: error: invalid suffix "color." on integer constant
   20 | Terminal type is xterm-256color.
      |                        ^~~~~~~~~
main.c:21:7: error: invalid suffix "$" on floating constant
   21 | -bash-4.4$ cd algo1/le08
      |       ^~~~
main.c:22:7: error: invalid suffix "$" on floating constant
   22 | -bash-4.4$ emacs C.c
      |       ^~~~
main.c:48:7: error: invalid suffix "$" on floating constant
   48 | -bash-4.4$ emacs C.c
      |       ^~~~
main.c:49:7: error: invalid suffix "$" on floating constant
   49 | -bash-4.4$ ls
      |       ^~~~
main.c:51:7: error: invalid suffix "$" on floating constant
   51 | -bash-4.4$ cd ..
      |       ^~~~
main.c:52:7: error: invalid suffix "$" on floating constant
   52 | -bash-4.4$ cd le04
      |       ^~~~
main.c:53:7: error: invalid suffix "$" on floating constant
   53 | -bash-4.4$ ls
      |       ^~~~
main.c:55:7: error: invalid suffix "$" on floating constant
   55 | -bash-4.4$ emacs C.c
      |       ^~~~
main.c:56:7: error: invalid suffix "$" on floating constant
   56 | -bash-4.4$ emacs C.c
      |       ^~~~
main.c:57:7: error: invalid suffix "$" on floating constant
   57 | -bash-4.4$ rm C.c
      |       ^~~~
main.c:58:7: error: invalid suffix "$" on floating constant
   58 | -bash-4.4$ emacs C.c
      |       ^~~~
main.c:59:7: error: invalid suffix "$" on floating constant
   59 | -bash-4.4$ gcc C.c
      |       ^~~~
main.c:60:18: warning: multi-character character constant [-Wmultichar]
   60 | C.c: In function 'main':
      |                  ^~~~~~
main.c:61:42: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
   61 | C.c:26:7: warning: passing argument 1 of 'insert' makes integer from pointer without a cast [enabled by default]
      |                                          ^~~~~~~~
main.c:63:8: error: expected identifier or '(' before '^' token
   63 |        ^
      |        ^
main.c:64:26: warning: multi-character character constant [-Wmultichar]
   64 | C.c:11:5: note: expected 'char' but argument is of type 'char *'
      |                          ^~~~~~
main.c:64:57: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
   64 | C.c:11:5: note: expected 'char' but argument is of type 'char *'
      |                                                         ^~~~~~~~
main.c:66:6: error: expected identifier or '(' before '^' token
   66 |      ^
      |      ^
main.c:67:42: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
   67 | C.c:29:4: warning: passing argument 1 of 'search' makes integer from pointer without a cast [enabled by default]
      |                                          ^~~~~~~~
main.c:69:5: error: expected identifier or '(' before '^' token
   69 |     ^
      |     ^
main.c:70:26: warning: multi-character character constant [-Wmultichar]
   70 | C.c:10:5: note: expected 'char' but argument is of type 'char *'
      |                          ^~~~~~
main.c:70:57: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
   70 | C.c:10:5: note: expected 'char' but argument is of type 'char *'
      |                                                         ^~~~~~~~
main.c:72:6: error: expected identifier or '(' before '^' token
   72 |      ^
      |      ^
main.c:74:41: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
   74 | C.c:42:11: error: conflicting types for 'getKey'
      |                                         ^~~~~~~~
main.c:77:41: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
   77 | C.c:7:11: note: previous declaration of 'getKey' was here
      |                                         ^~~~~~~~
main.c:79:12: error: expected identifier or '(' before '^' token
   79 |            ^
      |            ^
main.c:80:40: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
   80 | C.c:74:5: error: conflicting types for 'insert'
      |                                        ^~~~~~~~
main.c:83:41: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
   83 | C.c:11:5: note: previous declaration of 'insert' was here
      |                                         ^~~~~~~~
main.c:85:6: error: expected identifier or '(' before '^' token
   85 |      ^
      |      ^
main.c:86:7: error: invalid suffix "$" on floating constant
   86 | -bash-4.4$ emacs C.c
      |       ^~~~
main.c:87:7: error: invalid suffix "$" on floating constant
   87 | -bash-4.4$ gcc C.c
      |       ^~~~
main.c:93:7: error: invalid suffix "$" on floating constant
   93 | -bash-4.4$ emacs C.c
      |       ^~~~
main.c:94:7: error: invalid suffix "$" on floating constant
   94 | -bash-4.4$ gcc C.c
      |       ^~~~
main.c:95:7: error: invalid suffix "$" on floating constant
   95 | -bash-4.4$ emacs C.c
      |       ^~~~
main.c:96:7: error: invalid suffix "$" on floating constant
   96 | -bash-4.4$ pwd
      |       ^~~~
main.c:98:7: error: invalid suffix "$" on floating constant
   98 | -bash-4.4$ cd ..
      |       ^~~~
main.c:99:7: error: invalid suffix "$" on floating constant
   99 | -bash-4.4$ cd le10
      |       ^~~~
main.c:100:7: error: invalid suffix "$" on floating constant
  100 | -bash-4.4$ emacs C.c
      |       ^~~~
main.c:101:7: error: invalid suffix "$" on floating constant
  101 | -bash-4.4$ emacs C.c
      |       ^~~~
main.c:102:7: error: invalid suffix "$" on floating constant
  102 | -bash-4.4$ gcc C.c
      |       ^~~~
main.c:103:7: error: invalid suffix "$" on floating constant
  103 | -bash-4.4$ ./a.out
      |       ^~~~
main.c:108:7: error: invalid suffix "$" on floating constant
  108 | -bash-4.4$ emacs C.c
      |       ^~~~
main.c:109:7: error: invalid suffix "$" on floating constant
  109 | -bash-4.4$ gcc C.c
      |       ^~~~
main.c:110:7: error: invalid suffix "$" on floating constant
  110 | -bash-4.4$ ./a.out
      |       ^~~~
main.c:112:7: error: invalid suffix "$" on floating constant
  112 | -bash-4.4$ gcc C.c
      |       ^~~~
main.c:113:7: error: invalid suffix "$" on floating constant
  113 | -bash-4.4$ ./a.out
      |       ^~~~
main.c:115:7: error: invalid suffix "$" on floating constant
  115 | -bash-4.4$ emacs C.c
      |       ^~~~
main.c:116:7: error: invalid suffix "$" on floating constant
  116 | -bash-4.4$ emacs C.c
      |       ^~~~
main.c:117:7: error: invalid suffix "$" on floating constant
  117 | -bash-4.4$ gcc C.c
      |       ^~~~
main.c:118:18: warning: multi-character character constant [-Wmultichar]
  118 | C.c: In function 'lcs':
      |                  ^~~~~
main.c:121:8: error: expected identifier or '(' before '^' token
  121 |        ^
      |        ^
main.c:123:7: error: invalid suffix "$" on floating constant
  123 | -bash-4.4$ emacs C.c
      |       ^~~~
main.c:124:7: error: invalid suffix "$" on floating constant
  124 | -bash-4.4$ gcc C.c
      |       ^~~~
main.c:125:7: error: invalid suffix "$" on floating constant
  125 | -bash-4.4$ emacs C.c
      |       ^~~~
In file included from /usr/include/stdio.h:47,
                 from main.c:128:
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:28:43: error: unknown type name 'size_t'
   28 |                                           size_t __nbytes);
      |                                           ^~~~~~
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:1:1: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
  +++ |+#include <stddef.h>
    1 | /* Copyright (C) 1991-2025 Free Software Foundation, Inc.
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:37:44: error: unknown type name 'size_t'
   37 |                                            size_t __nbytes);
      |                                            ^~~~~~
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:37:44: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:57:3: error: unknown type name 'cookie_read_function_t'; did you mean 'cookie_seek_function_t'?
   57 |   cookie_read_function_t *read;         /* Read bytes.  */
      |   ^~~~~~~~~~~~~~~~~~~~~~
      |   cookie_seek_function_t
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:58:3: error: unknown type name 'cookie_write_function_t'; did you mean 'cookie_close_function_t'?
   58 |   cookie_write_function_t *write;       /* Write bytes.  */
      |   ^~~~~~~~~~~~~~~~~~~~~~~
      |   cookie_close_function_t
/usr/include/stdio.h:314:35: error: unknown type name 'size_t'
  314 | extern FILE *fmemopen (void *__s, size_t __len, const char *__modes)
      |                                   ^~~~~~
/usr/include/stdio.h:130:1: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
  129 | #include <bits/stdio_lim.h>
  +++ |+#include <stddef.h>
  130 | 
/usr/include/stdio.h:320:47: error: unknown type name 'size_t'
  320 | extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __THROW
      |                                               ^~~~~~
/usr/include/stdio.h:320:47: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:340:34: error: unknown type name 'size_t'
  340 |                     int __modes, size_t __n) __THROW __nonnull ((1));
      |                                  ^~~~~~
/usr/include/stdio.h:340:34: note: 'size_t'