//将字符串中的字符逆序输出,但不改变字符串中的内容. #include <stdio.h> /************found************/ void fun (char *a) { if ( *a ) { fun(a+) ;//使用递归进行数组的逆序输出. /************found************/ printf("%c",*a) ; } } void main( ) { ]="abcd"; printf("…
http://poj.grids.cn/practice/2744 描述现在有一些由英文字符组成的大小写敏感的字符串,你的任务是找到一个最长的字符串x,使得对于已经给出的字符串中的任意一个y,x或者是y的子串,或者x中的字符反序之后得到的新字符串是y的子串.输入输入的第一行是一个整数t (1 <= t <= 10),t表示测试数据的数目.对于每一组测试数据,第一行是一个整数n (1 <= n <= 100),表示已经给出n个字符串.接下来n行,每行给出一个长度在1和100之间的字符…
7-1 将数组中的数逆序存放 (20 分)   本题要求编写程序,将给定的n个整数存入数组中,将数组中的这n个数逆序存放,再按顺序输出数组中的元素. 输入格式: 输入在第一行中给出一个正整数n(1).第二行输入n个整数,用空格分开. 输出格式: 在一行中输出这n个整数的处理结果,相邻数字中间用一个空格分开,行末不得有多余空格. 输入样例: 4 10 8 1 2 输出样例: 2 1 8 10 1 #include<stdio.h> 2 3 int main(){ 4 int n=0; 5 sca…
与字符逆序(一)不同,句子逆序,单词顺序.例如:I am a student 输出为student a am I. 想法:先字符串句子逆序,然后针对每个单词再逆序一遍. package test; import java.util.Scanner; //一个句子单词顺序,句子逆序 public class exam10 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); whil…
python列表和字符串的三种逆序遍历方式 列表的逆序遍历 a = [1,3,6,8,9] print("通过下标逆序遍历1:") for i in a[::-1]: print(i, end=" ") print("\n通过下标逆序遍历2:") for i in range(len(a)-1,-1,-1): print(a[i], end=" ") print("\n通过reversed逆序遍历:") f…
Reverse a linked list from position m to n. Do it in-place and in one-pass. For example: Given 1->2->3->4->5->NULL, m = 2 and n = 4, return 1->4->3->2->5->NULL. Note: Given m, n satisfy the following condition: 1 ≤ m ≤ n ≤ le…
将一个字符串str的内容颠倒过来,并输出.str的长度不超过100个字符. 如:输入“I am a student”,输出“tneduts a ma I”. package test; import java.util.Scanner; /* 一个句子单词逆序.句子逆序 */ public class exam09 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while…
#include "string.h" #include "stdio.h" char * nixu(char *c) { ; int n = strlen(c); ; char *p2 = c; char *p3 = c; while(p1>p2) { char a; a = *p1; *p1 = *p2; *p2 = a; p1--; p2++; } return p3; } char *word(char *c) { char *p = c; int n…
线性栈 输入字符,再输出 #include "stdafx.h" #include<stdlib.h> #include<malloc.h> #define STACK_SIZE 100 #define STACKINCREAMENT 10 #define ERROR 0 #define OK 1 #define OVERFLOW -2 typedef int SElemType; typedef int Status; typedef char CElemTy…