zoukankan      html  css  js  c++  java
  • poj3602

    简单题

    View Code
    #include <iostream>
    #include
    <cstdio>
    #include
    <cstdlib>
    #include
    <cstring>
    using namespace std;

    string st;
    string g[100] =
    {
    "ffi", "ffl", "ff", "fl", "fi", "''", "``", "'", "`", ":", ";", ",", ".",
    "?", "!" };
    bool vis[300];

    int main()
    {
    //freopen("t.txt", "r", stdin);
    string a;
    st
    = "a";
    for (int i = 15; i < 41; i++)
    {
    g[i]
    = st;
    st[
    0]++;
    }
    st
    = "A";
    for (int i = 41; i < 67; i++)
    {
    g[i]
    = st;
    st[
    0]++;
    }
    st
    = "";
    while (getline(cin, a))
    st
    += a;
    int i = 0;
    int len = st.length();
    memset(vis,
    0, sizeof(vis));
    int ans = 0;
    while (i < len)
    {
    bool found = false;
    for (int j = 0; j < 67; j++)
    {
    int l = g[j].length();
    if (l + i <= len && st.substr(i, l) == g[j])
    {
    i
    += l;
    found
    = true;
    if (!vis[j])
    {
    vis[j]
    = true;
    ans
    ++;
    }
    break;
    }
    }
    if (!found)
    i
    ++;
    }
    printf(
    "%d\n", ans);
    return 0;
    }
  • 相关阅读:
    分红
    MyCat学习笔记
    vue 事例
    linux 端口
    vue安装
    react入门一(转)
    javascript 中各种继承方式的优缺点 (转)
    vue路由复习(转载)
    ES6新特性
    js面试中长见的算法题(转载)
  • 原文地址:https://www.cnblogs.com/rainydays/p/2130842.html
Copyright © 2011-2022 走看看